How To Reload Document By Resizing?
Why this code doesn't work: $(window).resize(function() { document.location.reload(); });
Solution 1:
Try the following code:
$(window).bind('resize',function(){
window.location.href = window.location.href;
});
Reference: http://forum.jquery.com/topic/anyone-know-how-to-refresh-reload-page-on-browser-resize
Solution 2:
The resize
event fires many times (depending on the browser) as you resize...there's probably a much better way to solve your problem (at least, I can't imagine that constantly reloading the page would be an optimal solution...).
For example if you're doing this to get your $(document).ready()
code to run again? In that case for example you can use a named function. For example:
function myFunc() {
//do stuff
}
$(myFunc); //run on DOM ready
$(window).resize(myFunc); //run when resizing
Post a Comment for "How To Reload Document By Resizing?"