jquery遍历数组的问题

来源:互联网 发布:js页面载入事件 编辑:程序博客网 时间:2024/04/30 23:53
var banner_li = $("#banner_ul li");
banner_li[0].css({"width":"300px"});//Uncaught TypeError: banner_li[0].css is not a function

分析:jquery的css样式函数不能用于数组

可以用each函数
banner_li.each(function(){
            $(this).css({"opacity":0, "zIndex":0});
        });
banner_li.eq(cur).animate({"zIndex":1, "opacity":1},1000);
0 0
原创粉丝点击