Skip to content

Commit 034c928

Browse files
committed
resize的操作
1 parent 06bcca5 commit 034c928

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

resize.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* @description resize的操作
3+
* @author 未知
4+
*/
5+
6+
(function(){
7+
var fn = function(){
8+
var w = document.documentElement ? document.documentElement.clientWidth : document.body.clientWidth
9+
,r = 1255
10+
,b = Element.extend(document.body)
11+
,classname = b.className;
12+
if(w < r){
13+
//当窗体的宽度小于1255的时候执行相应的操作
14+
}else{
15+
//当窗体的宽度大于1255的时候执行相应的操作
16+
}
17+
}
18+
if(window.addEventListener){
19+
window.addEventListener('resize', function(){ fn(); });
20+
}else if(window.attachEvent){
21+
window.attachEvent('onresize', function(){ fn(); });
22+
}
23+
fn();
24+
})();

0 commit comments

Comments
 (0)