[ACCEPTED]-JavaScript resize event on scroll - mobile-resize
Accepted answer
Cache the width of the viewport and on resize 2 return false if the width is still the same.
A 1 small jQuery snippet:
var cachedWidth = $(window).width();
$(window).resize(function(){
var newWidth = $(window).width();
if(newWidth !== cachedWidth){
//DO RESIZE HERE
cachedWidth = newWidth;
}
});
Use the onOrientationChange
event and the window.orientation
property instead.
Also 1 see this answer.
Here link to a test page.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.