在google maps api中设置draggablecursor属性的语法 [英] Syntax for setting draggablecursor property in google maps api
问题描述
我想将Google地图的Draggablecursor更改为自定义图片。我可以将它设置为诸如十字准线或移动之类的名称,但我无法使其与图像网址一起工作。我尝试了所有可能的语法,包括一些我认为是荒谬的错误。其中:
var mapOptions = {
...
draggableCursor:'../images/ mapcursor.jpg',
draggableCursor:'url(../ images / mapcursor.jpg)',
draggableCursor:'url(../ images / mapcursor.jpg)20 20,默认' ,
draggableCursor:'url(http://www.blablabla.com/images/mapcursor.png)',
draggableCursor:url(http://www.blablabla.com/images /mapcursor.png),
...
};
文档只是说它应该是鼠标悬停时显示的光标的名称或网址一个可拖动的地图。有人可以提供一些准确的语法应该是什么的指导或指针?网址中的默认这样的词是我不知道的。
谢谢
我设法使用外部网址:
var mapOptions = {
center:new google.maps.LatLng(-34.397,150.644),
zoom:8,
draggableCursor:'url(http://powerhut.co.uk/googlemaps/marker-images/image.png),十字线',
};
您可以使用<$ crosshair
c $ c> default,move ... 作为后备。
另请参阅报告问题。 b
$ b draggableCursor:'images / mycursor.png'
会起作用。完整路径的作品:
draggableCursor:'url(file:/// C:/Users/....../ Google%20Maps / images / finish.png),十字线',
以及短路径:
draggableCursor:'url(images / finish.png),crosshair',
所以,它的有效用法看起来似乎是:
draggableCursor:'url(externalLink | fullPath | relativePath),fallbackCursor',
I want to change the Draggablecursor for Google Maps to a custom image. I can set it to a name such as "crosshair" or "move" but I cannot get it to work with an image url. I tried every possible syntax I could google, including some which I thought were ridiculously wrong. Among them:
var mapOptions = {
...
draggableCursor: '../images/mapcursor.jpg',
draggableCursor: 'url("../images/mapcursor.jpg")',
draggableCursor: 'url(../images/mapcursor.jpg) 20 20, default' ,
draggableCursor: 'url("http://www.blablabla.com/images/mapcursor.png")',
draggableCursor: url("http://www.blablabla.com/images/mapcursor.png") ,
...
};
The documentation merely states that it should be "The name or url of the cursor to display when mousing over a draggable map." Can someone provide some guidance or pointers to what the exact syntax ought to be? Words like "default" in url are not known to me.
Thanks
I manage to get it using external url like:
var mapOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8,
draggableCursor: 'url(http://powerhut.co.uk/googlemaps/marker-images/image.png), crosshair',
};
Instead of crosshair
you can use default, move...
as fallback.
See also reported issue.
I expected that simple draggableCursor: 'images/mycursor.png'
would work. Full path works:
draggableCursor: 'url(file:///C:/Users/....../Google%20Maps/images/finish.png), crosshair',
and short path, too:
draggableCursor: 'url(images/finish.png), crosshair',
So, it seems that valid usage is:
draggableCursor: 'url(externalLink|fullPath|relativePath), fallbackCursor',
这篇关于在google maps api中设置draggablecursor属性的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!