首页 >web前端 >js教程 >jQuery内容折叠效果插件用法实例分析(附demo源码)_jquery

jQuery内容折叠效果插件用法实例分析(附demo源码)_jquery

WBOY
WBOY原创
2016-05-16 15:03:171398浏览

本文实例讲述了jQuery内容折叠效果插件用法。分享给大家供大家参考,具体如下:

<!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 class="brush:php;toolbar:false">
$('#fieldset1').coolfieldset();

Closed at start

If we want the fieldset to be closed or collapsed at start, just add {collapsed:true} as the argument.

$('#fieldset2').coolfieldset({collapsed:true});

Animation Speed

You can also define the animation speed for the fieldset while collapsing or expanding by using speed option. Acceptable values are "fast", "medium", "slow", or a number in millisecond.

$('#fieldset3').coolfieldset({speed:"fast"});

No Animation

If you don't want to use animation effect, please use animation option and fill its value with false.

$('#fieldset4').coolfieldset({animation:false});


Notes :
  • All content inside fieldset (except the legend tag) should be placed inside the div tag.
  • Edit the jquery.coolfieldset.css to change the fieldset style.
<script> $('#fieldset1, #fieldset3').coolfieldset(); $('#fieldset2').coolfieldset({collapsed:true}); $('#fieldset4').coolfieldset({speed:"fast"}); $('#fieldset5').coolfieldset({animation:false}); </script>

完整实例代码点击此处本站下载

更多关于jQuery相关内容感兴趣的读者可查看本站专题:《jQuery切换特效与技巧总结》、《jQuery拖拽特效与技巧总结》、《jQuery扩展技巧总结》、《jQuery常见经典特效汇总》、《jQuery动画与特效用法总结》、《jquery选择器用法总结》及《jQuery常用插件及用法总结

希望本文所述对大家jQuery程序设计有所帮助。

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
上一篇:如何使用jquery修改css中带有!important的样式属性_jquery下一篇:JavaScript String 对象常用方法总结_javascript技巧

相关文章

查看更多