光标在Google地图应用程序中消失 [英] Cursor disappears in Google Maps application

查看:148
本文介绍了光标在Google地图应用程序中消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这真的很奇怪。在使用API​​的v3创建Google Maps应用程序之后,有时当我将光标悬停在地图上时,鼠标光标将消失。我需要与地图外的几个控件进行交互。当我点击其中一个并且地图失去焦点后,问题就会显现出来。这事发生在别人身上过吗?

解决方案

简短回答:预加载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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆