Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.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
Javascript 删除锚定标记时删除列表样式Google Maps_Javascript_Jquery_Html_Asp.net Mvc_Google Maps Api 3 - Fatal编程技术网

Javascript 删除锚定标记时删除列表样式Google Maps

Javascript 删除锚定标记时删除列表样式Google Maps,javascript,jquery,html,asp.net-mvc,google-maps-api-3,Javascript,Jquery,Html,Asp.net Mvc,Google Maps Api 3,我有一个问题,因为我是新的HTML和附加锚标签。我的问题是,当附加的锚标记被删除时,列表上的样式没有被删除 另一个是,当它加载时,即使标记在谷歌地图上不存在,它仍然显示在列表上,直到我移动它一点,它在地图上被删除 以下是HTML: <div> <div id="map2" style="width: 900px; height: 500px;"></div> <div id="results1"> <h2>

我有一个问题,因为我是新的HTML和附加锚标签。我的问题是,当附加的锚标记被删除时,列表上的样式没有被删除

另一个是,当它加载时,即使标记在谷歌地图上不存在,它仍然显示在列表上,直到我移动它一点,它在地图上被删除

以下是HTML:

<div>
    <div id="map2" style="width: 900px; height: 500px;"></div>
    <div id="results1">
        <h2>Results</h2>
        <ul id="places1"></ul>
    </div>
</div>

后果
    这是密码

    function codeAddress() {
        infoBubble = new InfoBubble({
            map: map,
            shadowStyle: 0,
            padding: 10,
            borderRadius: 10,
            arrowSize: 15,
            maxWidth: 300,
            borderWidth: 1,
            borderColor: '#ccc',
            arrowPosition: 50,
            arrowStyle: 0
        });
        $.getJSON('/Dashboard/LoadCustomerList', function Geocode(address) {
            $.each(address, function () {
                var currVal = this["AddressLine1"];
                var Name = this["Name"];
                var clientID = this["ClientID"];
                var ID = this["ID"];
                var Latitude = this["Latitude"];
                var Longitude = this["Longitude"];
                var LatLang = new google.maps.LatLng(Latitude, Longitude);
    
                var marker = new google.maps.Marker({
                    map: map,
                    icon: iconBase + 'man.png',
                    position: LatLang,
                    title: currVal
                })
    
                var link = $('<a href="#">' + currVal + '</a>')
                    .data('location', LatLang);
                $('#places').append($('<li id=\'List1\' class=\'List1\'>').append(link));
                link.on('click', function (event) {
                    event.preventDefault();
                    google.maps.event.trigger(address[0], "click");
                    infoBubble.removeTab(0);
                    infoBubble.addTab(Name, "Name: " + Name + "<br> Address: " + currVal + "<br><br>" + '<center><a href="/Customer/CustomerDetails?clientCusId=' + ID + '&clientId=' + clientID + '">View Profile</a></center>');
                    infoBubble.open(map, marker);
                });
    
                google.maps.event.addListener(map, 'idle', function () {
                    $('#places').find('li a').css('display', function () {
                        return (map.getBounds().contains($(this).data('location')))
    
                        ? '' : 'none';
                    });
                });
    
                google.maps.event.addListener(marker, 'click', (function (marker, i) {
                    return function () {
                        infoBubble.removeTab(0);
                        infoBubble.addTab(Name, "Name: " + Name + "<br> Address: " + currVal + "<br><br>" + '<center><a href="/Customer/CustomerDetails?clientCusId=' + ID + '&clientId=' + clientID + '">View Profile</a></center>');
                        infoBubble.open(map, marker);
                    }
                })(marker, currVal));
                address.push(marker);
    
            })
            google.maps.event.trigger(map, 'bounds_changed');
        });
    }
    
    函数代码地址(){
    infoBubble=新的infoBubble({
    地图:地图,
    阴影样式:0,
    填充:10,
    边界半径:10,
    箭头尺寸:15,
    最大宽度:300,
    边框宽度:1,
    边框颜色:“#ccc”,
    箭头位置:50,
    箭头样式:0
    });
    $.getJSON('/Dashboard/LoadCustomerList',函数地理代码(地址){
    $。每个(地址、函数(){
    var currVal=this[“AddressLine1”];
    变量名称=此[“名称”];
    var clientID=此[“clientID”];
    变量ID=此[“ID”];
    var纬度=此[“纬度”];
    var经度=此[“经度”];
    var LatLang=new google.maps.LatLng(纬度、经度);
    var marker=new google.maps.marker({
    地图:地图,
    图标:iconBase+'man.png',
    职位:拉特朗,
    标题:currVal
    })
    变量链接=$('')
    .数据(“位置”,拉特朗);
    $('\'places').append($('
  • ').append(link)); link.on('click',函数(事件){ event.preventDefault(); google.maps.event.trigger(地址[0],“单击”); infoBubble.removeTab(0); infoBubble.addTab(名称,名称:“+Name+”
    地址:“+currVal+”

    “+”); 打开(地图、标记); }); google.maps.event.addListener(映射'idle',函数(){ $(“#places”).find('li a').css('display',function(){ 返回(map.getBounds()包含($(this.data('location')) “没有”; }); }); google.maps.event.addListener(标记,'click',(函数(标记,i){ 返回函数(){ infoBubble.removeTab(0); infoBubble.addTab(名称,名称:“+Name+”
    地址:“+currVal+”

    “+”); 打开(地图、标记); } })(标记,currVal)); 地址。推送(标记); }) google.maps.event.trigger(map'bounds_changed'); }); }
  • 我希望有人能帮我解决这类问题

    以下是电影片段:


    您到底想删除什么?整个“结果”容器?您能提供该页面的工作链接吗?@MrUpsidown抱歉,先生,我无法显示工作链接。我想删除这些样式。当列表中没有项目时。灰色列表当列表为空时,您可以显示HTML输出吗?您使用什么类来灰显行?@MrUpsidown当列表为空时,锚定标记类变为
    display:none
    ,灰行仅为
  • ,如果我们看到HTML/CSS仍然很好。