光标在Google地图应用程序中消失 [英] Cursor disappears in Google Maps application
问题描述
简短回答:预加载Google的手光标文件解决了这个问题。
详细解释:即使升级到17.0.963.56,我在OS X上也遇到了同样的问题。其他浏览器和Chrome在Windows上工作正常。
从自定义元素移动到地图图片时,光标不见了。在缩放控件和标记上,鼠标是可见的,但是在移开时它会再次消失。设置一个CSS游标:map-element下所有div的指针都可以让游标显示出来,但不是正确的样式。
我检查了Google Maps DOM并发现Google在地图图片上使用的是网址光标: http://maps.gstatic.com/mapfiles/openhand_8_8 .cur 。
预加载这个光标图像文件有不同的方法。你可以在你的html中创建一个隐藏的图像:
或者使用jQuery创建一个具有正确src属性的图像元素。
请让我知道这是否也为你解决。
This is really odd. After creating a Google Maps application using v3 of the API, sometimes the mouse cursor will disappear when I hover the cursor over the map. I have several controls outside of the map that I need to interact with. After I click on one of them and the map loses focus, the problem shows itself. Has anyone else had this happen? I tried setting the focus to the div where the map is but that didn't work.
Short answer: preloading Google's hand cursor file solves this problem.
Detailed explanation: I was experiencing the same issue in Chrome on OS X, even after upgrading to 17.0.963.56 today. Other browsers and Chrome on windows were working fine.
The cursor was gone when moving from a custom element onto the map image. On the zoom controls and markers, the mouse was visible but it disappeared again when moving off them. Setting a CSS cursor:pointer for all divs under the map-element made the cursor visible too, but not in the correct style of course.
I checked the Google Maps DOM and found out Google was using a url cursor when over the map image: http://maps.gstatic.com/mapfiles/openhand_8_8.cur.
There's different ways of preloading this cursor image file. You could create a hidden image in your html: Or use jQuery to create an image element with the right src attribute.
Please let me know if this solves it for you too.
这篇关于光标在Google地图应用程序中消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!