编辑1:
添加到插件设置:
'callbackModalOpen': null,
'callbackModalClose': null,
'callbackReset': null,
'jsonpCallback': null,
添加到插件功能:
var map = new google.maps.Map(document.getElementById(settings.mapDiv), myOptions);
$this.data('map', map);
//Custom reset callback
google.maps.event.addListenerOnce(map, 'idle', function () {
if (settings.callbackReset) {
settings.callbackReset.call(this, orig_lat, orig_lng, map, infowindow);
}
});
//Create one infowindow to fill later
var infowindow = new google.maps.InfoWindow();
我正在努力设置一个回调函数来重置jQuery Store Locator的映射。我的代码:
jQuery('#map-container').storeLocator({
callbackReset: function(orig_lat, orig_lng, map, infowindow){
var originLatLng = new google.maps.LatLng(orig_lat, orig_lng);
map.panTo(originLatLng); //Center the map
$('#loc-list li').removeClass('list-focus'); //Remove list focus
infowindow.close(); //Close infowindow
}
});
在我已声明的插件代码中:
'callbackReset': null,
和
//Custom reset callback
google.maps.event.addListenerOnce(map, 'idle', function(){
if(settings.callbackReset){
settings.callbackReset.call(this, orig_lat, orig_lng, map, infowindow);
}
});
我这样称呼它: jQuery('#map-container')。storeLocator('callbackReset':true);
检查没有错误,但没有工作。我在宣布这项职能时做错了什么?我希望能够在插件外部调用此重置,我该如何实现。感谢