jQuery文本段落展开和折叠效果
2014-01-13 15:20
555 查看
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jQuery文本段落展开和折叠效果</title> <style> #wrap{position: relative;padding: 10px;overflow: hidden;} #gradient{width: 100%;height: 35px;background: url() repeat-x;position: absolute;bottom: 0;left: 0;} </style> <script type="text/javascript" src="http://www.codefans.net/ajaxjs/jquery-1.6.2.min.js"></script> <script type="text/javascript"> $(function(){ var slideHeight = 75; // px var defHeight = $('#wrap').height(); if(defHeight >= slideHeight){ $('#wrap').css('height' , slideHeight + 'px'); $('#read-more').append('<a href="#">点击查看更多。。</a>'); $('#read-more a').click(function(){ var curHeight = $('#wrap').height(); if(curHeight == slideHeight){ $('#wrap').animate({ height: defHeight }, "normal"); $('#read-more a').html('点击隐藏'); $('#gradient').fadeOut(); }else{ $('#wrap').animate({ height: slideHeight }, "normal"); $('#read-more a').html('点击查看更多。。'); $('#gradient').fadeIn(); } return false; }); } }); </script> </head> <body> <div id="container"> <h1>jQuery 控制段落文字展开折叠,点击查看更多的功能</h1> <h2>About Billabong</h2> <div id="wrap"> <div> <p>Gordon developed his own stitching technique, which made the garments more durable, cost effective and less labor intensive. He employed machinists, moved the operation into a factory, set up a distribution network and sponsored a team of renowned Australian surfers. The business thrived.</p> <p>Since those beginnings, Billabong has expanded its product range to infdsafdsafdasfdsafdsafdasfdasfdsafdafdsafdsafdasfdclude boardsport products such as wetsuits, watches, surfboards, snowboard outerwear and skateboarding apparel.fdasfdsafdsafdsaffffffffff啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊Gordon developed his own stitching technique, which made the garments more durable, cost effective and less labor intensive. He employed machinists, moved the operation into a factory, set up a distribution network and sponsored a team of renowned Australian surfers. The business thrived.</p> <p>Since those beginnings, Billabong has expanded its product range to infdsafdsafdasfdsafdsafdasfdasfdsafdafdsafdsafdasfdclude boardsport products such as wetsuits, watches, surfboards, snowboard outerwear and skateboarding apparel.fdasfdsafdsafdsaffffffffff啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊</p> </div> <div id="gradient"></div> </div> <div id="read-more"></div> </div> </body> </html>
相关文章推荐
- 查询条件清空
- 开源jQuery插件推荐,帮你快速构建单页网站
- Jquery对表格进行操作——添加行、删除行和绑定行
- 如何忘却jQuery,开始使用JavaScript原生API
- jquery 隐藏和显示效果
- 锋利jquery---内容过滤选择器(第二章)
- jquery下拉列表的点击事件
- asp.net使用jquery实现搜索框默认提示功能
- asp.net使用jQuery获取RadioButtonList成员选中内容和值示例
- JQueryMobile + PhoneGap 经验总结
- [转载]Jquery Form插件表单参数
- jquery常用代码
- jquery插件formValidator的ajaxValidator传参数问题
- jQuery方法大全
- jquery 锚点跳转
- 9 款风格华丽的 jQuery/CSS3 插件推荐
- 9 款风格华丽的 jQuery/CSS3 插件推荐
- [转载]JQuery获取元素文档大小、偏移和位置和滚动条位置的方法集合
- 解密jQuery内核 DOM操作
- jquery一些语法