Monday, May 14, 2012

Reload page when a certain width is passed

I want the page to reload only if the browser window goes above or below 768px.
This was my attempt which failed.



if ($(window.width() > "769") {
$(window).resize(function () {
if ($(window).width() < "769") {
location.reload();
}
});

}
elseif($(window.width() < "769") {

$(window).resize(function () {
if ($(window).width() > "769") {
location.reload();
}
});

}


Im sures theres a really simple way of doing this.





No comments:

Post a Comment