Map works once / CSS height issues
See original GitHub issueHi im using iron router to load a template than contains a GoogleMap, it works perfectly the first time you navigate to the the route, but when access again, the map not work. Heres the code
Template.appraisalGeolocation.created = function() {
GoogleMaps.load({v: '3', key: '12345', libraries: 'geometry'});
GoogleMaps.ready('geolocation', geolocation.readyHandler);
}
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:27 (8 by maintainers)
Top Results From Across the Web
Issues with Google Map and 100% height? - Stack Overflow
Your map doesn't seem to load. Try specifying the canvas' width and height as absolute lengths rather than %. · Strangely enough, it...
Read more >Google Maps weird height problem - HTML & CSS - SitePoint
Suddenly our maps stopped working. well they work, but with weird height. Nothing has changed on our side so it seems Google changed ......
Read more >Google Maps not rendering with 100% height
The problem is, when I put on CSS height:100%, the map dont shows up. If I change it to 500px, it works fine....
Read more >Get Started | Maps Static API - Google Developers
For more information, see Using Map IDs. markers (optional) define one or more ... inserted into an img or div tag with the...
Read more >Configure width and height of 'pop-up' bubble on GMap - Drupal
Google maps are kind of weird for the way they work. The look of the map is somewhat inconsistant. The google map window...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the similar issue, instead of putting
googleMap
in atemplate
,Just create a DOM
then call explicitly based on different event triggers.
Hello.
The test app helped me find the problem after cutting out reems of code. Turns out a CSS class was causing the problem. From my example above, if I chuck away the following:
Everything works fine no matter how may times I leave and re-render the template containing the maps. The “hide” class was going to be used to handle some transition animations, and doesn’t actually map to anything concrete yet - my assumption is that code in my router file (that once the styles were defined) was running, and the timing of this versus the maps rendering was causing the problem (speculation again though - I’m new to most of this):
I’m going to bin that and find another solution for the transitions - I’d much rather have the maps working!
Thanks again for the help @dburles; massively appreciated.