我可以使用自己的自定义动画GIF作为Google Maps API上的标记吗? [英] Can I use my own custom animated gifs as markers on Google Maps API?
本文介绍了我可以使用自己的自定义动画GIF作为Google Maps API上的标记吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Google地图上使用不同的动画图片(gif)作为标记;我可以用API来做到这一点吗?
是的,你可以$ b
var position = new google.maps.LatLng(59.219521,/ 151 / edit> Live Example
): 15.1419873); var marker;
var map;
函数initialize(){
var mapOptions = {
zoom:16,
mapTypeId:google.maps.MapTypeId.ROADMAP,
center:position
};
map = new google.maps.Map(document.getElementById(map_canvas),mapOptions);
marker = new google.maps.Marker({
map:map,
draggable:false,
animation:google.maps.Animation.DROP,
位置:位置,
图标:http://heera.it/wp-content/themes/heerait/img/blog/me.png
});
您只需使用图标:icon-url
更新:
marker = new google.maps.Marker({
map:map,
draggable:false,
优化:false,//< - 动画gif
动画所需:google.maps.Animation.DROP,
位置:位置,
图标:http://blogs.technet.com/cfs-file.ashx/__key /communityserver-blogs-components-weblogfiles/00-00-01-01-35/e8nZC.gif
});
I want to use different animated cartoon images (gifs) as markers on Google Maps; can I do this with the API?
解决方案
Yes you can Live Example):
var position = new google.maps.LatLng(59.219521,15.1419873);
var marker;
var map;
function initialize() {
var mapOptions = {
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: position
};
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
marker = new google.maps.Marker({
map:map,
draggable:false,
animation: google.maps.Animation.DROP,
position: position,
icon: "http://heera.it/wp-content/themes/heerait/img/blog/me.png"
});
}
You just need to use icon:icon-url
when creating the marker.
Update:
marker = new google.maps.Marker({
map:map,
draggable:false,
optimized:false, // <-- required for animated gif
animation: google.maps.Animation.DROP,
position: position,
icon: "http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-01-35/e8nZC.gif"
});
这篇关于我可以使用自己的自定义动画GIF作为Google Maps API上的标记吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文