0

I have a select element with some countries, when "change" is fired, I call a function to get the coords then add the marker. It's ok but when the marker is added, the marker isn't centered.

I'm using the latest version 5.0b.

// get coords
$gmap.gmap3({
    getlatlng: {
        address: complete_address,
        callback: function(result){
            if(result) {
                var i = 0;
                $.each(result[0].geometry.location, function(index, value) {
                    if(i == 0) { lat = value; }
                    if(i == 1) { lng = value; }
                    i++;
                });

                // add marker
                $gmap.gmap3({
                    marker: {
                        address: complete_address,
                        options: {
                            draggable: false,
                            animation: google.maps.Animation.DROP
                        }
                    },
                    map:{
                        options:{
                            center:[lat, lng],
                            zoom: zoom
                        }
                    }
                });

            }
        }
    }
});

I get in the console: "Uncaught Error: Incorrect value for : 51.919438,19.14513599999998"

Any tips would by appreciate.

Regards

Syl
  • 2,232
  • 8
  • 34
  • 45

1 Answers1

1

Just found,

center: new google.maps.LatLng(lat, lng),
Syl
  • 2,232
  • 8
  • 34
  • 45
  • This kind of only works for me sometimes, It seems it centers correctly at times, then will be off to the north by a small swipe. do you get this also? – André Figueira Apr 09 '13 at 15:57