Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.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 标记的某些部分上的事件不起作用_Javascript_Jquery_Google Maps_Google Maps Api 3 - Fatal编程技术网

Javascript 标记的某些部分上的事件不起作用

Javascript 标记的某些部分上的事件不起作用,javascript,jquery,google-maps,google-maps-api-3,Javascript,Jquery,Google Maps,Google Maps Api 3,我有一个这样的代码 var data = [tons of lat long]; /* Create the markers */ for (var i = 0; i = data.length; i++) { /* Put the markers */ var marker = new google.maps.Marker({ position: { lat: parseFloat(lat1), lng: parseFloat(ln

我有一个这样的代码

var data = [tons of lat long];

/* Create the markers */
for (var i = 0; i = data.length; i++) {
    /* Put the markers */

    var marker = new google.maps.Marker({
    position: { 
        lat: parseFloat(lat1),
        lng: parseFloat(lng1)
    },
      map: map,
      icon: icon,
      label: {
        text: "Testing"
        color: 'black',
        fontSize: "9px"
      }
    });

    /* create popup */
    marker.content = sndformat();

     /* Put the pop up in the markers */
    var infoWindow = new google.maps.InfoWindow();

    /* Marker events  On Click */
    google.maps.event.addListener(marker, 'click', function (event) {
        /* Display popup */
        infoWindow.setContent(this.content);
        infoWindow.open(this.getMap(), this);

        /* Zoom In */
        curmarker = this.position;
        map.setCenter(curmarker);
        map.setZoom(20);

        /* If zoom out image has been clicked */
        $('#imgclick').bind('click', function() {          
          map.setCenter(default latlong);
          map.setZoom(7);
        });
    });
}
现在是我的问题。关注这个2

marker.content = sndformat();

上面的示例代码有效,其输出是创建一个带有弹出窗口的标记,弹出窗口上有一个按钮,因此当我单击标记时,它将放大,当我单击弹出窗口上的图像时,它将放大或转到默认区域

我这里的问题是,放大可以工作,但当图像单击“不工作”时,缩小不能在所有按钮上工作,只有部分按钮找到了它

$('#imgclick').bind('click', function() {
                      center = {lat: 12.8797, lng: 121.7740};          
                      map.setCenter(center);
                      map.setZoom(7);
                    });
$('#imgclick').bind('click', function() {
                      center = {lat: 12.8797, lng: 121.7740};          
                      map.setCenter(center);
                      map.setZoom(7);
                    });