zoukankan      html  css  js  c++  java
  • jQuery文本段落展开和折叠效果

     1 <!DOCTYPE html>
     2 <head>
     3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     4 <title>jQuery文本段落展开和折叠效果</title>
     5 <style>
     6 
     7 #wrap{position: relative;padding: 10px;overflow: hidden;}
     8 #gradient{width: 100%;height: 35px;background: url() repeat-x;position: absolute;bottom: 0;left: 0;}
     9 
    10 </style>
    11 <script type="text/javascript" src="http://www.codefans.net/ajaxjs/jquery-1.6.2.min.js"></script>
    12 <script type="text/javascript">
    13 $(function(){
    14     var slideHeight = 75; // px
    15     var defHeight = $('#wrap').height();
    16     if(defHeight >= slideHeight){
    17         $('#wrap').css('height' , slideHeight + 'px');
    18         $('#read-more').append('<a href="#">点击查看更多。。</a>');
    19         $('#read-more a').click(function(){
    20             var curHeight = $('#wrap').height();
    21             if(curHeight == slideHeight){
    22                 $('#wrap').animate({
    23                   height: defHeight
    24                 }, "normal");
    25                 $('#read-more a').html('点击隐藏');
    26                 $('#gradient').fadeOut();
    27             }else{
    28                 $('#wrap').animate({
    29                   height: slideHeight
    30                 }, "normal");
    31                 $('#read-more a').html('点击查看更多。。');
    32                 $('#gradient').fadeIn();
    33             }
    34             return false;
    35         });        
    36     }
    37 });
    38 </script>
    39 </head>
    40 <body>
    41     <div id="container">
    42         <h1>jQuery 控制段落文字展开折叠,点击查看更多的功能</h1>
    43         <h2>About Billabong</h2>
    44         <div id="wrap">
    45             <div>
    46                 <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>
    47                 <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>
    48                 <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>
    49             </div>
    50             <div id="gradient"></div>
    51         </div>
    52         <div id="read-more"></div>
    53     </div>
    54     
    55 </body>
    56 </html>
  • 相关阅读:
    网络中有三种通讯模式:单播、广播、组播(多播)
    chmod命令
    linux bash 命令重定向和多命令执行
    linux中管道符“|”的作用
    web测试常用的 linux 命令
    集群主要分成三大类 (高可用集群, 负载均衡集群,科学计算集群)
    iOS 监测电话呼入
    iOS NSUserDefaults [setValue:forKey:] [setObject:forKey:] <Objc> setValue(_,forKey:) set(_,forKey) <Swift 3>
    iOS 将navigationItem.titleView设置为自定义UISearchBar (Ficow实例讲解)
    iOS 加载Viewcontroller的几种方法
  • 原文地址:https://www.cnblogs.com/shijiewutonghua/p/3517499.html
Copyright © 2011-2022 走看看