forked from bitovi/jquerypp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresize.js
More file actions
44 lines (37 loc) · 1022 Bytes
/
resize.js
File metadata and controls
44 lines (37 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
steal('jquerypp/event/reverse', function($) {
var
// bind on the window window resizes to happen
win = $(window),
windowWidth = 0,
windowHeight = 0,
timer;
$(function() {
windowWidth = win.width();
windowHeight = win.height();
});
$.event.reverse('resize', {
handler : function(ev, data) {
var isWindow = this === window;
// if we are the window and a real resize has happened
// then we check if the dimensions actually changed
// if they did, we will wait a brief timeout and
// trigger resize on the window
// this is for IE, to prevent window resize 'infinate' loop issues
if ( isWindow && ev.originalEvent ) {
var width = win.width(),
height = win.height();
if ((width != windowWidth || height != windowHeight)) {
//update the new dimensions
windowWidth = width;
windowHeight = height;
clearTimeout(timer)
timer = setTimeout(function() {
win.trigger("resize");
}, 1);
}
return true;
}
}
});
return $;
});