如何使带有谷歌地图的网站使用鼠标滚轮事件进行平移而不是缩放?
我正在使用谷歌地图(v3)进行混搭,以根据实时 GPS 数据显示波士顿公交车的位置。 Google 通常使用滚动进行缩放,但我认为平移更有意义,特别是随着越来越多的计算机(尤其是 Mac)具有两指滚动,允许水平和垂直滚动。如果我可以获取滚动事件,我可以触发平移,但我不知道如何获取它们。我找到了 mousewheel jquery 插件,但它似乎只能轻松检测垂直滚动。 根据mozilla,firefox post 3.5为事件提供了“axis”属性,但是我找不到其他浏览器的任何内容。这是否太新而无法得到很好的支持?
I'm making a mashup with google maps (v3) to show where boston's buses are from realtime gps data. Google usually uses scrolling for zooming, but I think panning would make more sense, especially as more computers (especially macs) have two-finger scrolling, which allows both horizontal and vertical scrolling. If I could get at the scroll events, I could trigger panning, but I can't see how to get them. I found the mousewheel jquery plugin, but it only seems to detect vertical scrolling easily. According to mozilla, firefox post 3.5 gives the event an "axis" property, but I can't find anything for other browsers. Is this just too new to be well supported?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看我在 GitHub 上的“平滑滚动”项目。它的目的正是使这成为可能:
http://bentomas.github.com/smooth-scrolling/
Check out my 'Smooth Scrolling' project on GitHub. It aims to make exactly this possible:
http://bentomas.github.com/smooth-scrolling/
我之前使用过这段代码来检测鼠标滚轮事件 - 也许有一些用处。在 IE6+ 和 FF1.0+ 中工作正常 - 但未经最新浏览器的测试!
Ive used this code before to detect mouse wheel events - maybe of some use. Works fine in IE6+ and FF1.0 + - untested with very latest browsers though !