forked from snow0622/MyJavaScriptTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjQuery.wresize.js
More file actions
52 lines (47 loc) · 1.36 KB
/
Copy pathjQuery.wresize.js
File metadata and controls
52 lines (47 loc) · 1.36 KB
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
45
46
47
48
49
50
51
52
/**
* @authors 沈煦
* @date 2014-08-07 14:23:06
* @explain jQuery实现的onSize事件
*/
(function($){
$.fn.wresize = function(f) {
version = '1.1';
wresize = {
fired: false,
width: 0
};
function resizeOnce() {
if ($.browser.msie) {
if (!wresize.fired) {
wresize.fired = true;
} else {
var version = parseInt($.browser.version, 10);
wresize.fired = false;
if (version < 7) {
} else if (version == 7) {
//a vertical resize is fired once, an horizontal resize twice
var width = $(window).width();
if (width != wresize.width) {
wresize.width = width;
return false;
}
}
}
}
return true;
}
function handleWResize(e) {
if (resizeOnce()) {
return f.apply(this, [e]);
}
}
this.each(function() {
if (this == window) {
$(this).resize(handleWResize);
} else {
$(this).resize(f);
}
});
return this;
};
})(jQuery)