WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Jquery Issue but no errors (2 posts)

  1. Jacob Roman
    Member
    Posted 6 months ago #

    Hello,

    I have a Jquery conflict in my code I believe. I am using a plugin called WP-Property and custom added Jquery to create tabs inside that plugin. If you take a look at this page, http://princetonmanagement.com/apartments/marianne-manor/ you can see that most of the things load up just fine, but I am missing the google maps on the maps and direction tab. I get the page to load like this but as soon as I comment out this code:

    // if(typeof google == 'object') {
          //   initialize_this_map();
          // } else {
          //   jQuery("#property_map").hide();
          // }

    from this javascript that was in the plugin:

    <script type="text/javascript">
        var map;
        var marker;
        var infowindow;
    
        jQuery(document).ready(function ($) {
    
          if(typeof jQuery.fn.fancybox == 'function') {
            jQuery("a.fancybox_image, .gallery-item a").fancybox({
              'transitionIn'  :  'elastic',
              'transitionOut'  :  'elastic',
              'speedIn'    :  600,
              'speedOut'    :  200,
              'overlayShow'  :  false
            });
          }
    
          // if(typeof google == 'object') {
          //   initialize_this_map();
          // } else {
          //   jQuery("#property_map").hide();
          // }
    
        });
    
      function initialize_this_map() {
        <?php if($coords = WPP_F::get_coordinates()): ?>
        var myLatlng = new google.maps.LatLng(<?php echo $coords['latitude']; ?>,<?php echo $coords['longitude']; ?>);
        var myOptions = {
          zoom: <?php echo (!empty($wp_properties['configuration']['gm_zoom_level']) ? $wp_properties['configuration']['gm_zoom_level'] : 13); ?>,
          center: myLatlng,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        }
    
        map = new google.maps.Map(document.getElementById("property_map"), myOptions);
    
        infowindow = new google.maps.InfoWindow({
          content: '<?php echo WPP_F::google_maps_infobox($post); ?>',
          maxWidth: 500
        });
    
         marker = new google.maps.Marker({
          position: myLatlng,
          map: map,
          title: '<?php echo addslashes($post->post_title); ?>',
          icon: '<?php echo apply_filters('wpp_supermap_marker', '', $post->ID); ?>'
        });
    
        google.maps.event.addListener(infowindow, 'domready', function() {
        document.getElementById('infowindow').parentNode.style.overflow='hidden';
        document.getElementById('infowindow').parentNode.parentNode.style.overflow='hidden';
       });
    
       setTimeout("infowindow.open(map,marker);",1000);
    
        <?php endif; ?>
      }
      </script>

    Also if you look at the last tab on appointments I have a plugin in called BirchPress Appointments. That plugin is all messed up as well. I have been trying to troubleshoot this for a few weeks now and have not found a solution. Any help with this would be greatly appreciated. I feel like the issue is my javascript but not sure what exactly. I have also used this plugin Use Google Libraries to help with no conflict, but this does not seem to
    help me.

    I have disabled all the plugins and it only fixes a few issues, (the BirchPress plugin functions slightly.) I switched themes and everything seems to work, map shows up, so I know its a theme specific issue too.

    Any suggestions?

  2. Jacob Roman
    Member
    Posted 6 months ago #

    just had to switch a few thing around in the code and works great now.

Reply

You must log in to post.

About this Topic