Javascript Google Maps JS API v3和循环动画gif';s
我似乎无法用谷歌地图API循环动画GIF。它会在第一次播放动画,但之后不会再播放 谁能给我指出正确的方向吗?我在这个文件中有很多代码,所以我已经拖出了重要的部分,如果需要的话,我会很高兴地再放一些Javascript Google Maps JS API v3和循环动画gif';s,javascript,google-maps-api-3,google-maps-markers,Javascript,Google Maps Api 3,Google Maps Markers,我似乎无法用谷歌地图API循环动画GIF。它会在第一次播放动画,但之后不会再播放 谁能给我指出正确的方向吗?我在这个文件中有很多代码,所以我已经拖出了重要的部分,如果需要的话,我会很高兴地再放一些 var marker = new google.maps.MarkerImage( 'library/img/gmap_marker.gif', new google.maps.Size(100, 100), new google.maps.Point(0, 0), n
var marker = new google.maps.MarkerImage(
'library/img/gmap_marker.gif',
new google.maps.Size(100, 100),
new google.maps.Point(0, 0),
new google.maps.Point(100, 100)
);
var shadow = new google.maps.MarkerImage(
'library/img/gmap_shadow.png',
new google.maps.Size(100, 100),
new google.maps.Point(0, 0),
new google.maps.Point(100, 100)
);
// set the personmarker
var person = new google.maps.Marker({
position: currentPos,
icon: marker,
draggable: false,
raiseOnDrag: false,
shadow: shadow,
animation: google.maps.Animation.DROP,
map: app.map,
optimized: false
});
关键是设置
optimized:false
,但由于您已经设置了,并且它不起作用,所以我测试了创建自己的简单示例,它起了作用
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Google Maps JavaScript API v3 Example: Marker Simple</title>
<link href="https://google-developers.appspot.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="http://maps.googleapis.com/maps/api/js?v=3&sensor=false"></script>
<script>
function initialize() {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var mapOptions = {
zoom: 4,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!',
icon: "http://gwtportlets.googlecode.com/svn-history/r46/trunk/src/org/gwtportlets/portlet/public/img/portlet-loading-32x32.gif",
optimized: false
});
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas">
</div>
</body>
</html>
谷歌地图JavaScript API v3示例:标记简单
函数初始化(){
var mylatng=new google.maps.LatLng(-25.363882131.044922);
变量映射选项={
缩放:4,
中心:myLatlng,
mapTypeId:google.maps.mapTypeId.ROADMAP
}
var map=new google.maps.map(document.getElementById('map_canvas'),mapOptions);
var marker=new google.maps.marker({
职位:myLatlng,
地图:地图,
标题:“你好,世界!”,
图标:“http://gwtportlets.googlecode.com/svn-history/r46/trunk/src/org/gwtportlets/portlet/public/img/portlet-loading-32x32.gif",
优化:错误
});
}
根据您的需要编辑它,您也可以尝试使用google.maps.MarkerImage
切换到google.maps.icon
,因为MarkerImage似乎已被弃用请参见:和
祝da代码好运 关键是设置
优化:false
,但由于您已经设置了,并且它不起作用-我测试了创建自己的简单示例,它起作用了
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Google Maps JavaScript API v3 Example: Marker Simple</title>
<link href="https://google-developers.appspot.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="http://maps.googleapis.com/maps/api/js?v=3&sensor=false"></script>
<script>
function initialize() {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var mapOptions = {
zoom: 4,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!',
icon: "http://gwtportlets.googlecode.com/svn-history/r46/trunk/src/org/gwtportlets/portlet/public/img/portlet-loading-32x32.gif",
optimized: false
});
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas">
</div>
</body>
</html>
谷歌地图JavaScript API v3示例:标记简单
函数初始化(){
var mylatng=new google.maps.LatLng(-25.363882131.044922);
变量映射选项={
缩放:4,
中心:myLatlng,
mapTypeId:google.maps.mapTypeId.ROADMAP
}
var map=new google.maps.map(document.getElementById('map_canvas'),mapOptions);
var marker=new google.maps.marker({
职位:myLatlng,
地图:地图,
标题:“你好,世界!”,
图标:“http://gwtportlets.googlecode.com/svn-history/r46/trunk/src/org/gwtportlets/portlet/public/img/portlet-loading-32x32.gif",
优化:错误
});
}
根据您的需要编辑它,您也可以尝试使用google.maps.MarkerImage
切换到google.maps.icon
,因为MarkerImage似乎已被弃用请参见:和
祝da代码好运 看起来它最终与gif有关。看起来它最终与gif有关。