Comments (2)
Next round of updates I can look into this more closely, but for now,
What you'll want to call is mapobj.map.invalidateSize();
.
You should be able to find the mapobj
in window.leafletphp.maps
, which is a dictionary. The map is given a random ID each time, so you could to do something like this:
jQuery('#mytabs').on('tabchange',function(e){ // <--- Or whatever the tab change event is
for(mapobj in window.leafletphp.maps){
mapobj.map.invalidateSize();
}
});
from geometa-acf.
Thanks for the quick response! It generally worked, but I had to tweak a bit. I think the solution could be better, but this is all I can do for now. The click event of the tab was what I attached to, because i didn't now how to attach to the tab block being made visible. I added a delay though because on click the block isn't yet visible and invalidateSize wasn't working. Unless I clicked again.
Also The event fires twice when I click on the tab. No idea why. My selector is pretty specific.
This is what I ended up with:
jQuery("#acf-group_5a9ea4efe5997 .acf-tab-wrap [data-key='field_5a9ea930ce67f']").on("click",function(e){
setTimeout(function() {
for(mapobj in window.leafletphp.maps){
m = window.leafletphp.maps[mapobj].map;
m.invalidateSize();
}
}, 100);
});
from geometa-acf.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geometa-acf.