Google Maps JS API v3 and looping animated gif's

后端 未结 1 1160
渐次进展
渐次进展 2021-01-26 13:12

I can\'t seem to loop animated gifs with the Google Maps API. It plays the animation the first time around but will not play it again after that.

Can anyone point me in

相关标签:
1条回答
  • 2021-01-26 13:21

    Key is to set optimized: false, but since you already have and its not working - I tested to create own simple example and it worked.

    <!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>
    

    Edit it as you please to suit your needs, you can also try to swap using of google.maps.MarkerImage to google.maps.icon because MarkerImage seems to be deprecated see : MarkerImage and Icon.

    Good luck with da code.!

    0 讨论(0)
提交回复
热议问题