您的位置:首页 > Web前端 > JQuery

jquery stop filter each end

2016-06-20 17:51 579 查看
  //语法结构 stop([clearQueue][,gotoEnd]);
  $("button:eq(1)").click(function(){
    $("#panel").stop();//停止当前动画,继续下一个动画,继默认状态stop(false,false);
  });
  $("button:eq(2)").click(function(){
    $("#panel").stop(true);//清除元素的所有动画
  });
  $("button:eq(3)").click(function(){
    $("#panel").stop(false, true);//让当前动画直接到达末状态 ,继续下一个动画
  });
  $("button:eq(4)").click(function(){
    $("#panel").stop(true, true);//清除元素的所有动画,让当前动画直接到达末状态
  });

//filter:
$("li").filter(function(index){
return $('strong',this).length == 2;//搜索strong在this 中
}).css("backgroundColor","#f00")

/*<ul>
<li><strong>list</strong> item 1 - one strong tag</li>
<li><strong>list</strong> item <strong>2</strong>
- two <span>strong tags</span></li>  //变为红色
<li>list item 3</li>
<li>list item 4</li>
</ul>*/
 
//filter:
1、选择器+遍历
$('div').each(function (i){
i就是索引值
this 表示获取遍历每一个dom对象
});
2、选择器+遍历
$('div').each(function (index,domEle){
index就是索引值
domEle 表示获取遍历每一个dom对象
});
3、更适用的遍历方法
1)先获取某个集合对象
2)遍历集合对象的每一个元素
var d=$("div");
$.each(d,function (index,domEle){
d是要遍历的集合
index就是索引值
domEle 表示获取遍历每一个dom对
});
})
4、end() 方法结束当前链条中的最近的筛选操作,并将匹配元素集还原为之前的状态。</span>


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: