谷歌地图API和gMapsLatLonPicker

问题描述:

我使用gMapsLatLonPicker plugin上一个模式(基础6显示),问题是,我意识到我需要为了在模态工作,例如手动加载插件:谷歌地图API和gMapsLatLonPicker

$('#modal').on("open.zf.reveal", function(ev,elem) { 
    /*when the modal fires open*/ 
    $(document).gMapsLatLonPicker().init($(this)); /*Init the plugin*/ 
}); 

但是我不想在每次有人打开模式时初始化插件,你知道是否有另一种方法吗?

你可以尝试这样的事情

var first_time = true; 

$('#modal').on("open.zf.reveal", function(ev,elem) { 
    /*when the modal fires open*/ 
    if(first_time==true){ 
     $(document).gMapsLatLonPicker().init($(this)); /*Init the plugin*/ 
     first_time=false; 
    } 
}); 
+0

认为可能存在更好的解决方案,但是,是的,这是一个方便, – user3068333