I have a site that needs to reload after resizing and have found my own limit of coding a script, that automatically reloads the page:
I want the script to behave like follows:
if window width was
< 768pxand stays< 768pxI do not want to reload the pageif window width was
>= 768pxand goes< 768pxI want to reload the page onceif window width was
< 768pxand goes>= 768pxI want to reload the pageif window width was
>= 768pxand stays>= 768pxit always should reload
The last part is done easy using the following code:
// After resize events
var id;
$(window).resize(function() {
    clearTimeout(id);
    id = setTimeout(doneResizing, 500);
});
function doneResizing(){
    if($(window).width() > 767) {
        if (window.RT) clearTimeout(window.RT);
          window.RT = setTimeout(function()
          {
            this.location.reload(false); /* false to get page from cache */
          }, 200);
    }
}
I think I have to create a var that stores the current $(window).width(); and than check with if {} else if {} else {}, but from this point my mind looses the control.
 
     
    