Jquery Google Maps API弹跳动画不起作用

时间:2015-02-25 15:06:11

标签: jquery google-maps-api-3

我无法通过点击来获取弹跳动画,有人可以指出我正确的方向:

   <script type="text/javascript">


    window.onload = function () {


        var mapOptions = {
            center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
            zoom: 6,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };

        var infoWindow = new google.maps.InfoWindow();
        var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
        var image = 'marker.png';

        for (i = 0; i < markers.length; i++) {



            var data = markers[i]
            var myLatlng = new google.maps.LatLng(data.lat, data.lng);


            var marker = new google.maps.Marker({
                position: myLatlng,
                map: map,
                title: data.title,

                icon: new google.maps.MarkerImage(icon),
                visible: fred,
                draggable: false,
                animation: google.maps.Animation.DROP



            });




      (function (marker, data) {

                google.maps.event.addListener(marker, "click", function (e) {

                    infoWindow.setContent("<b><u>" + data.name + " - " + data.custcode + "</u></b>" +
                    "<br />" + data.address1 + " , " + data.address2 + "<br />" + data.county
                     + "<br />" + data.postcode + "<br />" + data.tel + "<br />" + data.category + "<br /> <b>Rep:</b>" + data.repcode + "<b>    House:</b>" + data.rephouse + " <b>   Key:</b>" + data.repkey);
                    infoWindow.open(map, marker);
                    if (marker.getAnimation() != null) {
                        marker.setAnimation(null);
                    } else {
                        marker.setAnimation(google.maps.Animation.BOUNCE);
                    }

                });

        }
    }



</script>

我在Chrome上的javascript控制台中没有出现任何错误。当我单击地图上的标记时,除了信息窗口之外没有任何其他事情发生。我希望它反弹,以便显示所选标记。

0 个答案:

没有答案