jQuery內(nèi)容折疊效果插件用法實(shí)例分析(附demo源碼)
本文實(shí)例講述了jQuery內(nèi)容折疊效果插件用法。分享給大家供大家參考,具體如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>jQuery Collapsible Fieldset</title>
<script src="js/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.coolfieldset.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.coolfieldset.css" />
</head>
<body>
<h1>jQuery Collapsible Fieldset</h1>
<br/>
<fieldset id="fieldset1" class="coolfieldset">
<legend>Default</legend>
<div>
<p>By default the <b>fieldset</b> is opened or expanded at start. Click on its <b>legend</b> to close or collapse it.</p>
<p>The code is simply like below</p>
<pre>
$('#fieldset1').coolfieldset();
</pre>
</div>
</fieldset>
<br/>
<fieldset id="fieldset2" class="coolfieldset">
<legend>Closed at start</legend>
<div>
<p>If we want the fieldset to be closed or collapsed at start, just add <b>{collapsed:true}</b> as the argument.</p>
<pre>
$('#fieldset2').coolfieldset({collapsed:true});
</pre>
</div>
</fieldset>
<br/>
<fieldset id="fieldset4" class="coolfieldset">
<legend>Animation Speed</legend>
<div>
<p>You can also define the animation speed for the fieldset while collapsing or expanding by using <b>speed</b> option. Acceptable values are "<b>fast</b>", "<b>medium</b>", "<b>slow</b>", or a number in millisecond.</p>
<pre>
$('#fieldset3').coolfieldset({speed:"fast"});
</pre>
</div>
</fieldset>
<br/>
<fieldset id="fieldset5" class="coolfieldset">
<legend>No Animation</legend>
<div>
<p>If you don't want to use animation effect, please use <b>animation</b> option and fill its value with <b>false</b>.</p>
<pre>
$('#fieldset4').coolfieldset({animation:false});
</pre>
</div>
</fieldset>
<br/><br/>
<fieldset id="fieldset3" class="coolfieldset">
<legend>Notes :</legend>
<div>
<ul>
<li>All content inside fieldset (except the <b>legend</b> tag) should be placed inside the <b>div</b> tag.</li>
<li>Edit the <b>jquery.coolfieldset.css</b> to change the fieldset style.</li>
</ul>
</div>
</fieldset>
<script>
$('#fieldset1, #fieldset3').coolfieldset();
$('#fieldset2').coolfieldset({collapsed:true});
$('#fieldset4').coolfieldset({speed:"fast"});
$('#fieldset5').coolfieldset({animation:false});
</script>
</body>
</html>
完整實(shí)例代碼點(diǎn)擊此處本站下載。
更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery切換特效與技巧總結(jié)》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常見(jiàn)經(jīng)典特效匯總》、《jQuery動(dòng)畫與特效用法總結(jié)》、《jquery選擇器用法總結(jié)》及《jQuery常用插件及用法總結(jié)》
希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。
相關(guān)文章
鋒利的jQuery 要點(diǎn)歸納(二) jQuery中的DOM操作(下)
鋒利的jQuery 要點(diǎn)歸納(二) jQuery中的DOM操作(下)2010-03-03
jquery+CSS3實(shí)現(xiàn)3D拖拽相冊(cè)效果
這篇文章主要為大家詳細(xì)介紹了jquery+CSS3實(shí)現(xiàn)3D拖拽相冊(cè)效果的具體代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-07-07
asp.net 30分鐘掌握無(wú)刷新 Repeater
經(jīng)過(guò)數(shù)個(gè)版本的迭代后, JQueryElement 3.3.0 版本中的 Repeater 基本上已經(jīng)完善, 這里將分功能的總結(jié)講解一下 Repeater 的使用方法.2011-09-09
jQuery滾動(dòng)插件scrollable.js用法分析
這篇文章主要介紹了jQuery滾動(dòng)插件scrollable.js用法,簡(jiǎn)單分析了scrollable.js的功能、方法及相關(guān)使用技巧,需要的朋友可以參考下2017-05-05
jquery中的mouseleave和mouseout的區(qū)別 模仿下拉框效果
不論鼠標(biāo)指針離開(kāi)被選元素還是任何子元素,都會(huì)觸發(fā) mouseout 事件,只有在鼠標(biāo)指針離開(kāi)被選元素時(shí),才會(huì)觸發(fā) mouseleave 事件2012-02-02
jquery操作checkbox實(shí)現(xiàn)全選和取消全選
這篇文章主要介紹了jquery操作checkbox實(shí)現(xiàn)全選和取消全選,需要的朋友可以參考下2014-05-05
使用jQuery實(shí)現(xiàn)的擲色子游戲動(dòng)畫效果
大家一定都玩過(guò)擲色子的游戲,今天我給大家分享的是如何使用jQuery來(lái)實(shí)現(xiàn)擲色子的動(dòng)畫效果,通過(guò)jQuery的animate()自定義動(dòng)畫函數(shù)并結(jié)合CSS背景圖片切換實(shí)現(xiàn)的動(dòng)畫效果2014-03-03
jQueryMobile之Helloworld與頁(yè)面切換的方法
這篇文章主要介紹了jQueryMobile之Helloworld與頁(yè)面切換的方法,實(shí)例分析了jQueryMobile的基礎(chǔ)用法,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-02-02

