吉吉于

jQuery 抄袭笔记(6) : Hide特效

摘自w3school :

$(this).hide() – 隐藏当前元素

$(“p”).hide() – 隐藏所有段落

$(“p.test”).hide() – 隐藏所有 的段落

$(“#test”).hide() – 隐藏所有 id=”test” 的元素

hide() 和 show() 都可以设置两个可选参数:speed 和 callback。

speed 参数可以设置这些值:”slow”, “fast”, “normal” 或 milliseconds

callback 参数是在 hide 或 show 函数完成之后被执行的函数名称。

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
</span>
<meta http-equiv=“Content-Type” content=“text/html; charset=gb2312″ />
</span>Hello Lazynight!<span style="color: #ff4400; font-weight: bold;"></title></span><br /> <span style="color: #ff4400; font-weight: bold;"><script </span><span style="color: #ffff00;">type=</span><span style="color: #d13800;">“text/javascript”</span> <span style="color: #ffff00;">src=</span><span style="color: #d13800;">“jquery-1.1.3.pack.js”</span><span style="color: #ff4400; font-weight: bold;">></script></span><br /> <span style="color: #ff4400; font-weight: bold;"><script </span><span style="color: #ffff00;">type=</span><span style="color: #d13800;">“text/javascript”</span><span style="color: #ff4400; font-weight: bold;">></span><br /> <span style="color: #c0c0c0;">$</span>(<span style="color: #c0c0c0;">document</span><span style="color: #c0c0c0;">).</span><span style="color: #c0c0c0;">ready</span>(<span style="color: #ff4400; font-weight: bold;">function</span><span style="color: #c0c0c0;">(){</span><br /> <span style="color: #c0c0c0;">$</span>(<span style="color: #d13800;">“a”</span><span style="color: #c0c0c0;">).</span><span style="color: #c0c0c0;">click</span>(<span style="color: #ff4400; font-weight: bold;">function</span><span style="color: #c0c0c0;">(){</span><br /> <span style="color: #c0c0c0;">$</span>(<span style="color: #ff4400; font-weight: bold;">this</span><span style="color: #c0c0c0;">).</span><span style="color: #c0c0c0;">hide</span>(<span style="color: #d13800;">“slow”</span>);<br /> <span style="color: #ff4400; font-weight: bold;">return</span> <span style="color: #ff4400; font-weight: bold;">false</span>;<br /> <span style="color: #c0c0c0;">});</span><br /> <span style="color: #c0c0c0;">});</span><br /> <span style="color: #ff4400; font-weight: bold;"></script></span><br /> <span style="color: #ff4400; font-weight: bold;"></head></span><br /> <span style="color: #ff4400; font-weight: bold;"><body></span><br /> <span style="color: #ff4400; font-weight: bold;"><a</span> <span style="color: #ffff00;">href=</span><span style="color: #d13800;">“http://lazynight.me”</span><span style="color: #ff4400; font-weight: bold;">></span><br /> 点我吧~点我我就慢慢消失…<br /> "return false"表示页面不会跳转至链接页面<br /> <span style="color: #ff4400; font-weight: bold;"></a></span><br /> <span style="color: #ff4400; font-weight: bold;"></body></span><br /> <span style="color: #ff4400; font-weight: bold;"></html></span> </div> <span style="color: #ff0000;"><a href="http://down.qiannao.com/space/file/flowerowl/-4e0a-4f20-5206-4eab/Lazy6_hide-7279-6548.rar/.page" target="_blank"><span style="color: #ff0000;">下载源码</span></a></span> 转载请注明:[于哲的博客][1] » [jQuery 抄袭笔记(6) : Hide特效][2] [1]: http://lazynight.me [2]: http://lazynight.me/420.html </body></span>