开发者

Google Maps v3 panTo Callback?

开发者 https://www.devze.com 2023-03-12 11:49 出处:网络
How can I set a callback function on a single specified panTo call? Here is my code. var loc = data.split(\',\');

How can I set a callback function on a single specified panTo call? Here is my code.

var loc = data.split(',');
map.panTo(new google.maps.LatLng(loc[0], loc[1]), function(){
    console.log('this never logs...'开发者_如何学JAVA);
});


It's not clear to me what you are trying to achieve. Are you hoping the callback will run when the panning finishes? If so, you can try this:

map.panTo(new google.maps.LatLng(loc[0], loc[1]));
google.maps.event.addListenerOnce(map, 'idle', function(){
    console.log('this logs after the panTo finishes.');
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号