on window resize scale
See original GitHub issueHere is how I do when window is resized (not a bug) it’s just to share (AND if you have a better way let me know 😃
jsvmap = new JsVectorMap({
//...
});
// window on resize
var resizeMapTimer;
window.addEventListener('resize', function(e) {
clearTimeout(resizeMapTimer);
resizeMapTimer = setTimeout(function() {
jsvmap.height = window.innerHeight;
$("#map svg").setAttribute("height", window.innerHeight);
jsvmap.width = window.innerWidth;
$("#map svg").setAttribute("width", window.innerWidth);
jsvmap.baseScale = 1;
//console.log(jsvmap);
}, 250);
});
// Trigger resize event one time at start
if (typeof(Event) === 'function') {
// modern browsers
window.dispatchEvent(new Event('resize'));
} else {
// for IE and other old browsers
// causes deprecation warning on modern browsers
var evt = window.document.createEvent('UIEvents');
evt.initUIEvent('resize', true, false, window, 0);
window.dispatchEvent(evt);
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Scale down / up every html element when window resize
I would like to keep the same layout instead of responsive, but scale up / down everything when I resize the window screen....
Read more >Window: resize event - Web APIs | MDN
The resize event fires when the document view (window) has been resized. This event is not cancelable and does not bubble.
Read more >Implement responsive aspect ratio on window resize ... - Daily.co
Use CSS, JavaScript, or React hooks to style your Daily Prebuilt iframe to responsively maintain aspect ratio dimensions on window resize.
Read more >Scale in horizontal and vertical direction on window resize
On horizontal window resize the mesh always stays completely visible due to rescaling. On horizontal scaling the mesh does not scale. My feature ......
Read more >Resizing a Three.js Scene When the Browser Window Size ...
I'm going to add an window resize event listener that executes a function when the browser window resizes. This function then updates the...
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 FreeTop 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
Top GitHub Comments
@themustafaomar I forked your pen example, now seem to work right 👍 @panpansh look at this simple responsive map
Unfortunately, I won’t be able to find a solution currently as time is not on my side 😦 However, I’ll leave this issue opened until I come :]