Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 引导程序2模态removeData_Jquery_Twitter Bootstrap_Twitter Bootstrap 2_Jquery Gmap3 - Fatal编程技术网

Jquery 引导程序2模态removeData

Jquery 引导程序2模态removeData,jquery,twitter-bootstrap,twitter-bootstrap-2,jquery-gmap3,Jquery,Twitter Bootstrap,Twitter Bootstrap 2,Jquery Gmap3,我有一个使用gmap3插件的地图脚本,正在整理如何在点击标记时实现模式。一切都正常,除了当我点击一个新的标记时,我的脚本正在从以前点击的标记加载字符串。我在脚本中放置了.removeData,但它似乎不起作用 以下是脚本: <script> $('#map_canvas').gmap3({ map:{ options:{ streetViewControl: false, mapTypeId: google.maps.MapTypeId.TERR

我有一个使用gmap3插件的地图脚本,正在整理如何在点击标记时实现模式。一切都正常,除了当我点击一个新的标记时,我的脚本正在从以前点击的标记加载字符串。我在脚本中放置了.removeData,但它似乎不起作用

以下是脚本:

<script>
$('#map_canvas').gmap3({
  map:{
    options:{ 
      streetViewControl: false,
      mapTypeId: google.maps.MapTypeId.TERRAIN,
      mapTypeControl: true,
      mapTypeControlOptions: {
        style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
      },
    }
  },
  marker:{
    values:[
        <!-- TMPL_LOOP Listings -->
            <!-- TMPL_IF have_geocode -->
                {latLng:[<!-- TMPL_VAR latitude -->, <!-- TMPL_VAR longitude -->],data:'<div class="modal-body"></div><div class="modal-footer"><a href="/property/detail/<!-- TMPL_VAR listing_id -->" class="btn btn-small btn-primary" target="_self">View Details</a></div>',options:{icon: "/static/images/mapmarker.png"}},
            <!-- TMPL_ELSE -->
                {address:"<!-- TMPL_VAR street_no --> <!-- TMPL_VAR street -->, <!-- TMPL_VAR city -->, <!-- TMPL_VAR state --> <!-- TMPL_VAR zip -->",data:'<div class="modal-body"></div><div class="modal-footer"><a href="/property/detail/<!-- TMPL_VAR listing_id -->" class="btn btn-small btn-primary" target="_self">View Details</a></div>',options:{icon: "/static/images/mapmarker.png"}},
            <!-- /TMPL_IF -->
        <!-- /TMPL_LOOP -->
    ],
    options:{
      draggable: false
    },
    events:{
        click: function(marker, event, context){
            $('#mapModal').on('hidden', function() {
                $(this).removeData('modal');
            });
            $('#mapModal').append('<div class="modal-body"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>'+(context.data)+'</div>');
            $('#mapModal').modal('show')
            $(this).gmap3('get').panTo(marker.getPosition());
        },
    },
  },
  autofit:{},
});
以及模态容器:

<div id="mapModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="mapModalLabel" aria-hidden="true"></div>
已解决:

$('#mapModal').empty();