本文介绍了Google地图dragend事件v3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
google.maps.event.addListener(map,'dragend ',function(){checkBounds();});
但是我发现然后我扔地图(即在iPhone上点击地图直到滚动)dragend发生在地图完成移动之前;给我一个虚假的边界。有没有办法知道边界何时停止移动,这是优美的?我知道我可以继续使用bounds_changed反复检查;然而,想知道是否有一个更干净的方式做到这一点。
干杯
解决方案
尝试使用空闲侦听器,尽管在缩放后也会触发。
Currently I have this listener event on my google maps:
google.maps.event.addListener(map, 'dragend', function() { checkBounds(); });
However I find that then I "throw" the map (ie on an iPhone taking and clicking the map up to scroll) the dragend happens before the map is done moving; giving me a false boundary. Is there a way to know when the bounds have stopped moving that is graceful? I know i can continue to check using the bounds_changed over and over; however was wondering if there was a cleaner way of doing this.
Cheers
解决方案
Try the idle listener instead, although that will also fire after a zoom.
这篇关于Google地图dragend事件v3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!