我已经完成了谷歌地图,动画标记网站的一部分。我正在使用尺寸为160X243px的自定义图像作为标记图标。我将弹跳动画放入mouseover
事件中,并移除mouseout
上的动画。问题是我在动画开始的时候出现了一些混乱,就像开始时模糊不清。有什么办法可以避免这种情况?我已经设置了一个延迟来解决这个问题,但它没有什么帮助。下面是我用于动画的代码。谷歌地图标记动画中的闪烁
WITH OUT DELAY
google.maps.event.addListener(marker, "mouseover", function() {
marker.setAnimation(google.maps.Animation.BOUNCE);
});
google.maps.event.addListener(marker, "mouseout", function() {
marker.setAnimation(null);
});
具有滞后
google.maps.event.addListener(marker, "mouseover", function() {
setTimeout(function() {
addMarkerMethod1();
}, 400);
});
google.maps.event.addListener(marker, "mouseout", function() {
setTimeout(function() {
addMarkerMethod2();
}, 100);
});
function addMarkerMethod1()
{
marker.setAnimation(google.maps.Animation.BOUNCE);
}
function addMarkerMethod2()
{
marker.setAnimation(null);
}
你可以使用jsfiddle在工作演示中显示的问题? – Cdeez
好吧,我现在将它发布 – arjuncc
我不能发布它在jsfiddle,但我可以提供一个链接 http://export.idreamzsolutions.net/brewhousecafe/ – arjuncc