WordPress.org

Forums

WP Google Maps
[resolved] Jquery Tabs (4 posts)

  1. SameOldShane
    Member
    Posted 2 years ago #

    Hi,

    I have the pro version of your WP Google Maps plugin and i was wondering if you could help me get the maps working in the jquery tabs on my site?
    they only show the first map and the rest are broken i'm guessing this is because the map does not refresh from tab to tab.

    Is there a way around this or a fix?

    If not is there a way of letting links go to markers on one when clicked?

    Kind Regards,

    Shane

    http://wordpress.org/extend/plugins/wp-google-maps/

  2. WPGMaps
    Member
    Plugin Author

    Posted 2 years ago #

    Hi
    I have a solution for this. Will you be able to send me an email on nick@wpgmaps.com as well as your log in details. There's a few lines I will hard code into the javascript that will get this to work.

    Kind regards
    Nick

  3. SameOldShane
    Member
    Posted 2 years ago #

    Hi Nick,

    I try not to give out my site details is there a way you can do this without?
    Or is there a way you can show me how to hardcode in your plugin?

  4. WPGMaps
    Member
    Plugin Author

    Posted 2 years ago #

    Hi SameOldShane

    What you would need to do is edit wp-google-maps-pro.php and find the following function: wpgmaps_user_javascript_pro()

    Within that function, if you scroll down a bit you will find the following JavaScript function:

    function InitMap_<?php echo $wpgmza_cmd; ?>() {
       var myLatLng = new google.maps.LatLng(<?php echo
    $wpgmza_lat[$wpgmza_cmd]; ?>,<?php echo $wpgmza_lng[$wpgmza_cmd]; ?>);
       MYMAP_<?php echo $wpgmza_cmd; ?>.init("<?php echo
    "#wpgmza_map_".$wpgmza_cmd; ?>", myLatLng, <?php echo
    $start_zoom[$wpgmza_cmd]; ?>);
       UniqueCode=Math.round(Math.random()*10000);
       MYMAP_<?php echo $wpgmza_cmd; ?>.placeMarkers('<?php echo
    wpgmaps_get_marker_url($wpgmza_cmd); ?>?u='+UniqueCode,<?php echo
    $wpgmza_cmd; ?>);
     };
     InitMap_<?php echo $wpgmza_cmd; ?>();

    Just below that, add something like this:

    jQuery(".accordion h2").click(function() {
      InitMap_1();
      InitMap_2();
    });

    InitMap_1(); would re-initialize the Google Map with an ID of 1. Change these numbers to suit the shortcodes on the page. For example, if you have the map ID 34 on your page, you would need to change it to InitMap_34();

    Please also change the ".accordion h2" to the relevant DOM element that triggers the accordian or jQuery tab.

    It's a bit messy but it does the trick.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Google Maps
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags