切換顯示和隱藏
切換顯示和隱藏
切換顯示和隱藏
上述方法的參數詳解:
示例:
<script>//隱藏divfunction hideFn(){/* $("#showDiv").hide("slow","swing",function(){alert("隱藏了...")});*/
/*//默認方式$("#showDiv").hide(5000,"swing");
*/
/*//滑動方式$("#showDiv").slideUp("slow");*///淡入淡出方式$("#showDiv").fadeOut("slow");}//顯示divfunction showFn(){/*$("#showDiv").show("slow","swing",function(){alert("顯示了...")});*//*//默認方式$("#showDiv").show(5000,"linear");*/
/*//滑動方式$("#showDiv").slideDown("slow");*///淡入淡出方式$("#showDiv").fadeIn("slow");}//切換顯示和隱藏divfunction toggleFn(){/*//默認方式$("#showDiv").toggle("slow");
*//*//滑動方式$("#showDiv").slideToggle("slow");
*///淡入淡出方式$("#showDiv").fadeToggle("slow");}</script>
jquery UI?jq的遍歷方式
語法:
jquery對象.each(function(index,element){});
回調函數返回值:
//1.獲取所有的ul下的livar citys = $("#city li");//2. jq對象.each(callback)citys.each(function (index,element) {//3.1 獲取li對象 第一種方式 thisalert(this.innerHTML);//或者alert($(this).html());//3.2 獲取li對象 第二種方式 在回調函數中定義參數 index(索引) element(元素對象)alert(index+":"+element.innerHTML);//或者alert(index+":"+$(element).html());//判斷如果是上海,則跳出本次循環if("上海" == $(element).html()){//如果當前function返回為false,則結束循環(break)。//如果返回為true,則結束本次循環,繼續下次循環(continue)return true;}
$.each(citys,function () {alert($(this).html());}
for(li of citys){alert($(li).html());}
jq對象.toggle(fn1,fn2…)
jquery vue。注意:1.9版本 .toggle() 方法刪除,jQuery Migrate(遷移)插件可以恢復此功能。
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态