码迷,mamicode.com
首页 > 编程语言 > 详细

each处理一维数组二维数组和JS改变屏幕事件

时间:2017-05-24 16:04:55      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:绑定   var   use   als   ide   ref   listener   数组元素   数组   

改变屏幕大小事件
window.onresize=function(){
            var w=$(window).width();
            if((w<1189)){
                $(‘.one‘).hide();
            }
        }

each处理一维数组
$.each(arr,function(i,val)){
alert(i);alert(val)
}
each处理二维数组
$.each(arr2,function(i,item){
    alert(i)输出二维数组有几个数组元素
    alert(item) 将输出每一个数组
})


 
var scrollFunc = function(e) {
var direct = 0;
e = e || window.event;
if (e.wheelDelta) {  //判断浏览器IE,谷歌滑轮事件
if(e.wheelDelta > 0) { //当滑轮向上滚动时
alert("滑轮向上滚动");
}
if(e.wheelDelta > 0) { //当滑轮向上滚动时
alert("滑轮向上滚动");
}
if(e.wheelDelta < 0) { //当滑轮向下滚动时
alert("滑轮向下滚动");
}
} else if (e.detail) {  //Firefox滑轮事件
if(e.detail>0) { //当滑轮向上滚动时
alert("滑轮向上滚动");
}
if (e.detail< 0) {
//当滑轮向下滚动时
alert("滑轮向下滚动");
}
}
ScrollText(direct);
}
//给页面绑定滑轮滚动事件
if(document.addEventListener) {
document.addEventListener(‘DOMMouseScroll‘,scrollFunc, false);
}
//滚动滑轮触发scrollFunc方法
window.onmousewheel =document.onmousewheel = scrollFunc;

each处理一维数组二维数组和JS改变屏幕事件

标签:绑定   var   use   als   ide   ref   listener   数组元素   数组   

原文地址:http://www.cnblogs.com/lixiaoni/p/6898918.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!