最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Loading screen for Google Maps - Stack Overflow

programmeradmin0浏览0评论

I've noticed that Google Maps is taking longer than usual to load these days, and causes the browser to refresh many times before loading. Either way, this has led me to wonder how I can create a loading screen to display before the map fully loads.

Any suggestions?

Update: (In response to Gabi's code)

google.maps.event.addListener(map, 'tilesloaded', function(){
    document.getElementById('loading').innerHTML = '';
})

Is it possible to have a loading PNG overlay the entire map and remove it just before the tilesloaded event?

I've noticed that Google Maps is taking longer than usual to load these days, and causes the browser to refresh many times before loading. Either way, this has led me to wonder how I can create a loading screen to display before the map fully loads.

Any suggestions?

Update: (In response to Gabi's code)

google.maps.event.addListener(map, 'tilesloaded', function(){
    document.getElementById('loading').innerHTML = '';
})

Is it possible to have a loading PNG overlay the entire map and remove it just before the tilesloaded event?

Share Improve this question edited Jul 20, 2012 at 9:38 Tony 10.4k3 gold badges50 silver badges77 bronze badges asked Jun 28, 2011 at 6:32 NyxynyxNyxynyx 63.8k163 gold badges507 silver badges856 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

You can listen to the tilesloaded event:

google.maps.event.addListener(map, 'tilesloaded', function(){
    document.getElementById('loading').innerHTML = '';
})

Here is a working jsfiddle: http://jsfiddle/96WgM/2/

Alternatively, you could just set a loading gif image as the map div background:

http://jsfiddle/c962U/

发布评论

评论列表(0)

  1. 暂无评论