Google Map Initialisation Problem - pretty photo doesnt open first click
  • Hi there,

    I'm trying to open a custom Google map with pretty photo - I've followed the tutorial on the prettyPhoto site, and have it working to a degree.

    The problem is that the map only opens after you click the link twice - never the first time - below is the markup, and script that i have used - please could you tell me what I'm doing wrong?

    Thank you:


    Mark-up & script:




    google.load("jquery", "1.4.2");






    // functgion to initialize map - takes longtitude and latitude as arguments
    function initialize(longtitude, latitude) {


    // create new gmap
    var map = new GMap2(document.getElementById('map_canvas'));
    // set variable for map center
    var thisMap = new GLatLng(longtitude, latitude);
    // set center of the map
    map.setCenter(thisMap, 8 );

    map.setZoom(13);

    // add zoom control
    map.addControl(new GLargeMapControl());

    // add trype controls
    map.addControl(new GMapTypeControl());

    // set variable for map marker
    var point = new GLatLng(longtitude, latitude);
    // set marker to equal point
    marker = new GMarker(point);
    // add marker to map
    map.addOverlay(marker);



    }





    Open a Google Map




    $(document).ready(function(){


    $('.pplink').bind('click',function () {

    var thislink = $(this);
    var latitude = $(this).attr('data-lat');
    var longtitude = $(this).attr('data-long');


    thislink.prettyPhoto({
    custom_markup: '
    ',
    changepicturecallback: function(){ initialize(latitude,longtitude); }
    });

    });

    });



  • functional example here if anyone can help - thanks:

    http://www.markaprice.co.uk/2011dev/example/gmap.html

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!