$("ul").show(500); //顯示
$("ul").hide(slow); //隱藏
$("ul").toggle(normal); //顯示 / 隱藏
複製代碼
案例:幾張圖片依次的顯示與隱藏javascript
$(function () {
$("#btn1").click(function () {
//獲取div,最後一個圖片,隱藏
$("div>img").last("img").hide(800,function () {
//arguments.callee至關於遞歸
$(this).prev().hide(800,arguments.callee);
});
});
//顯示
$("#btn2").click(function () {
$("div>img").first("img").show(800,function () {
//arguments.callee至關於遞歸
$(this).next().show(800,arguments.callee);
});
});
});
複製代碼
( 「div" ).slideDown(1000); $( 「div" ).slideToggle(1000);java
("#dv").fadeOut(1000);
("#dv").fadeTo(1000,0.3);ide
("ul")stop().hide(slow); //隱藏函數
$(function () {
$("#btn").click(function () {
$("#dv").animate({"width":"300px","height":"300px","left":"300px"},1000,function () {
$("#dv").animate({"width":"50px","height":"30px","left":"800px","top":"300px","opacity":0.2},2000);
});
});
複製代碼