5
var stockholm = new google.maps.LatLng(59.32522, 18.07002);
var parliament = new google.maps.LatLng(59.327383, 18.06747);
var marker;
var map;
function initialize() {
var mapOptions = {
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: stockholm
};
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
marker = new google.maps.Marker({
map:map,
draggable:true,
animation: google.maps.Animation.DROP,
position: parliament,
icon: '/img/marker.png'
});
google.maps.event.addListener(marker, 'click', toggleBounce);
setTimeout(function() { marker.setAnimation(google.maps.Animation.BOUNCE); }, 2000);
}
function toggleBounce() {
if (marker.getAnimation() != null) {
marker.setAnimation(null);
} else {
marker.setAnimation(google.maps.Animation.BOUNCE);
}
}
,我這個修改後的示例代碼不知道是否有可能從DROP改變標誌動畫DROP動畫停止後的反彈?
我設法改變它使用setTimeout()函數,但它並沒有做到這一點順利。任何幫助將不勝感激。
經過和它不工作。 – debianek 2012-08-14 22:39:17