首頁  >  效果  > show([s,[e],[fn]])

返回值:jQueryshow([speed,[easing],[fn]])

jQuery show() 方法概述

顯示隱藏的匹配元素。

這個就是 'show( speed, [callback] )' 無動畫的版本。如果選擇的元素是可見的,這個方法將不會改變?nèi)魏螙|西。無論這個元素是通過hide()方法隱藏的還是在CSS里設置了display:none;,這個方法都將有效。

參數(shù)

speed[,fn]Number/String,FunctionV1.0

speed:三種預定速度之一的字符串("slow","normal", or "fast")或表示動畫時長的毫秒數(shù)值(如:1000)

fn:在動畫完成時執(zhí)行的函數(shù),每個元素執(zhí)行一次。

[speed],[easing],[fn]Number/String,String,FunctionV1.4.3

speed:三種預定速度之一的字符串("slow","normal", or "fast")或表示動畫時長的毫秒數(shù)值(如:1000)

easing:(Optional) 用來指定切換效果,默認是"swing",可用參數(shù)"linear"

fn:在動畫完成時執(zhí)行的函數(shù),每個元素執(zhí)行一次。

示例

描述:

顯示所有段落

HTML 代碼:
<p style="display: none">Hello</p>
jQuery 代碼:
$("p").show()

描述:

用緩慢的動畫將隱藏的段落顯示出來,歷時600毫秒。

HTML 代碼:
<p style="display: none">Hello</p>
jQuery 代碼:
$("p").show("slow");

描述:

用迅速的動畫將隱藏的段落顯示出來,歷時200毫秒。并在之后執(zhí)行反饋!

HTML 代碼:
<p style="display: none">Hello</p>
jQuery 代碼:
$("p").show("fast",function(){
   $(this).text("Animation Done!");
 });

描述:

將隱藏的段落用將近4秒的時間顯示出來。。。并在之后執(zhí)行一個反饋。。。

HTML 代碼:
<p style="display: none">Hello</p>
jQuery 代碼:
$("p").show(4000,function(){
   $(this).text("Animation Done...");
 });