codecamp

show([speed,[easing],[fn]])

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

概述

显示隐藏的匹配元素。

这个就是 'show( speed, [callback] )' 无动画的版本。如果选择的元素是可见的,这个方法将不会改变任何东西。无论这个元素是通过hide()方法隐藏的还是在CSS里设置了display:none;,这个方法都将有效。

参数

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

speed:三种预定速度之一的字符串("slow","normal", or "fast")或表示动画时长的毫秒数值(如:1000)

fn:在动画完成时执行的函数,每个元素执行一次。

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

speed:三种预定速度之一的字符串("slow","normal", or "fast")或表示动画时长的毫秒数值(如:1000)

easing:(Optional) 用来指定切换效果,默认是"swing",可用参数"linear"

fn:在动画完成时执行的函数,每个元素执行一次。

示例

描述:

显示所有段落

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

描述:

用缓慢的动画将隐藏的段落显示出来,历时600毫秒。

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

描述:

用迅速的动画将隐藏的段落显示出来,历时200毫秒。并在之后执行反馈!

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

描述:

将隐藏的段落用将近4秒的时间显示出来。。。并在之后执行一个反馈。。。

HTML 代码:
<p style="display: none">Hello</p>
jQuery 代码:
$("p").show(4000,function(){
   $(this).text("Animation Done...");
 });
animate(param,[spe],[e],[fn])
stop([cle],[jum])
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }