Title: Full map not loading
Last modified: December 14, 2020

---

# Full map not loading

 *  [Vlad.C](https://wordpress.org/support/users/vladc-1/)
 * (@vladc-1)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/full-map-not-loading/)
 * Hello,
 * Firstly, thanks a lot for your plugin. You’re doing an awesome job!
 * I’ve got a problem with the map loading on my website. The full map isn’t loading,
   only part of it ([see here](https://prnt.sc/w2b46e)).
 * Before posting this, I’ve had a look around other support tickets opened here
   and discussions on Stack Overflow ([like this one](https://stackoverflow.com/questions/41742326/why-isnt-my-map-completely-showing))
   and noticed that many others had this problem.
 * On Stack Overflow there’s a solution to run map.invalidateSize() when the page
   layout is stable. I’ve noticed someone else also open a ticket here asking you
   where to put that code ([see here](https://wordpress.org/support/topic/map-not-rendering-properly-when-added-inside-an-accordion/)),
   but your answer isn’t clear enough for me. I still don’t understand where to 
   put the code.
 * A bit more context. Our website is running MyListing theme and the syntax we’re
   using for the map to appear [is this one](https://prnt.sc/w2b93u). At the moment
   we don’t have any caching plugins or anything else that could interfere and cause
   this issue.
 * I’d really appreciate some help with this.
 * Thanks in advance!
 * P.S.: Sometimes the whole map is loaded, so maybe when you try, it will be loaded.
   Try loading a few times, or other pages.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffull-map-not-loading%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [vbrandl](https://wordpress.org/support/users/vbrandl/)
 * (@vbrandl)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/full-map-not-loading/#post-13937370)
 * I have the exact same problem on [https://www.ebsnet.de](https://www.ebsnet.de).
 * Loading the page with caching disabled (either via the developer tools or using`
   CTRL+F5`) helps to reproduce the issue.
 * Resizing the browser window triggers a redraw and the map will be rendered correctly.
 * I’d love some pointers on how to execute `invalidateSize()` on map created using
   this plugin.
 *  Thread Starter [Vlad.C](https://wordpress.org/support/users/vladc-1/)
 * (@vladc-1)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/full-map-not-loading/#post-13941798)
 * Not sure this plugin is still supported. It’s been a month and a half since I
   asked the question.. A shame.
 *  Plugin Author [bozdoz](https://wordpress.org/support/users/bozdoz/)
 * (@bozdoz)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/full-map-not-loading/#post-13943444)
 * The solution here lies in the FAQ on github:
 * [https://github.com/bozdoz/wp-plugin-leaflet-map#how-can-i-add-another-leaflet-plugin](https://github.com/bozdoz/wp-plugin-leaflet-map#how-can-i-add-another-leaflet-plugin)
 * The title is How Can I Add Another Leaflet Plugin, but really it’s How Can I 
   Execute Any Arbitrary JavaScript.
 * So, just guessing here, but you should be able to add this to your functions.
   php:
 *     ```
       add_action('leaflet_map_loaded', 'custom_leaflet_loaded');
       function custom_leaflet_loaded() {
         // custom js
         wp_enqueue_script('custom_leaflet', get_theme_file_uri( '/js/custom-leaflet.js' ), Array(), '1.0', true);
       }
       ```
   
 * and your /js/custom-leaflet.js file should have something like this:
 *     ```
       (function () {
         function main() {
           if (!window.WPLeafletMapPlugin) {
             console.log('no plugin found!');
             return;
           }
   
           function invalidateMaps() {
             var maps = window.WPLeafletMapPlugin.maps;
   
             for (var i = 0, len = maps.length; i < len; i++) {
               var map = maps[i];
               map.whenReady(function () {
                 this.addControl(new L.Control.Fullscreen());
               });
             }
           }
   
           invalidateMaps();
   
           window.addEventListener('resize', invalidateMaps);
         }
   
         window.addEventListener('load', main);
       })();
       ```
   
 * Hope that helps.
 *  [vbrandl](https://wordpress.org/support/users/vbrandl/)
 * (@vbrandl)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/full-map-not-loading/#post-13952187)
 * Thanks for your reply.
 * While this helps in that I now got a reference to every map created by the plugin,
   calling `this.invalidateSize();` inside the `whenReady` callback does not seem
   to fix the issue at hand…
 *  Thread Starter [Vlad.C](https://wordpress.org/support/users/vladc-1/)
 * (@vladc-1)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/full-map-not-loading/#post-13952470)
 * Thank you for your answer, [@bozdoz](https://wordpress.org/support/users/bozdoz/).
   I really do appreciate it.
 * The above code **only solved the issue for Chrome**. The maps are **still not
   loading correctly in Firefox, Opera & Edge**.
 * Why is that?
 *  Plugin Author [bozdoz](https://wordpress.org/support/users/bozdoz/)
 * (@bozdoz)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/full-map-not-loading/#post-13953750)
 * Not sure. I’ve heard a couple of claims that it doesn’t work in Safari, but I
   don’t think I’ve been able to reproduce it. Also, I only test in firefox, so 
   ideally it ought to at least work in Firefox.
 *  [vbrandl](https://wordpress.org/support/users/vbrandl/)
 * (@vbrandl)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/full-map-not-loading/#post-13957502)
 * For now, we worked around it by setting the map `witdh` to `150%`. This way, 
   the tiles that cannot be loaded are outside the visible screen. The map marker
   is not in the center now, but it’s a compromise…

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Full map not loading’ is closed to new replies.

 * ![](https://ps.w.org/leaflet-map/assets/icon-256x256.png?rev=1693083)
 * [Leaflet Map](https://wordpress.org/plugins/leaflet-map/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/leaflet-map/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/leaflet-map/)
 * [Active Topics](https://wordpress.org/support/plugin/leaflet-map/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/leaflet-map/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/leaflet-map/reviews/)

## Tags

 * [display issues](https://wordpress.org/support/topic-tag/display-issues/)

 * 7 replies
 * 3 participants
 * Last reply from: [vbrandl](https://wordpress.org/support/users/vbrandl/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/full-map-not-loading/#post-13957502)
 * Status: not resolved