blob: 76bb6da37238ab15972890fc8d7821a83abedeb3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
var context;
var $window = $(window);
// run this right away to set context
if ($window.width() <= 768) {
context = 'small';
} else if (768 < $window.width() < 970) {
context = 'medium';
} else {
context = 'large';
}
// refresh the page only if you're crossing into a context
// that isn't already set
$(window).resize(function() {
if(($window.width() <= 768) && (context != 'small')) {
//refresh the page
location.reload();
} else if ((768 < $window.width() < 970) && (context != 'medium')) {
location.reload();
} else if (context != 'large') {
location.reload();
}
});
|