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

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

jQuery show() 方法概述

顯示隱藏的匹配元素。

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

參數(shù)

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

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

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

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

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

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

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

示例

描述:

顯示所有段落

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

描述:

用緩慢的動(dòng)畫將隱藏的段落顯示出來,歷時(shí)600毫秒。

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

描述:

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

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

描述:

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

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