×

表格中的点击更多实现滑动展开和收缩功能

作者:流泪的石头2017.11.28来源:Web前端之家浏览:6390评论:0
关键词:表格table
微信公众号

微信公众号

帮一个朋友写了个表格,需要实现多个交易账号的显示隐藏功能,看下截图:

图片.png

好吧,话不多说,直接上干货代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        body{font:14px microsoft yahei,helvetica,arial;background:#fff;color:#333;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;-ms-text-size-adjust:none;text-size-adjust:none}
        body,p,ol,ul,li,h1,h2,h3,h4,h5,h6,dl,dt,dd,pre,input,table,tr,td,button,textarea,button{margin:0;padding:0}
        section,article,aside,header,footer,nav,dialog,figure,address{display:block}
        input[type=button],input[type=text],input[type=password]{-webkit-appearance:none;outline:none}
        ol,ul,li{list-style:none}
        input,button{border:0 none}
        .dn{display:none}
        .calenda-tablist th,.calenda-tablist td{border-bottom:dotted #E9E9E9 1px;text-align:center;white-space:nowrap;padding:10px 0}
        .calenda-tablist th{font-weight:normal;white-space:nowrap}
        .calenda-tablist td{color:#666}
        .calenda-tablist .t-l{padding-left:15px;text-align:left}
        .calenda-tablist .dat-zhd,.data-ss-info strong{color:#333}
        .calenda-tablist .cal-tr-bg td{background:#FBFBFB}
        .calenda-tablist .t-wid{width:20%}
        .calenda-tablist .t-wid2{width:78px}
        .calenda-tablist .t-time{display:inline-block;font:14px/20px "DINPro","arial";color:#a0a0a0;text-align:center}
        .calenda-tablist .sj-name-fon{color:#ad8b46}
        .calenda-tablist .xiangq-btn{font:18px "\5B8B\4F53";color:#ccc}
        .calenda-tablist .xing-info span{display:inline-block;width:13px;height:13px;line-height:13px;font-size:0;vertical-align:middle;background-position:0 -37px}
        .calenda-tablist .xing-info .gray{;background-position:-13px -37px}
        .calenda-tablist .t-country{color:#a7a7a7}
        .calenda-tablist .t-country img{display:inline-block;width:20px}
        .acc-pbox p{line-height:1.2}
        .acc-dian{margin-top:-4px;line-height:10px}
    </style>
</head>
<body>
    <table width="100%" cellspacing="0" cellpadding="0" class="calenda-tablist">      
        <thead>
            <tr>
              <th width="15%">交易账号</th>
              <th width="15%">成交时间</th>
              <th width="15%">报价</th>
              <th width="15%">成交价格</th>
              <th width="10%">操作</th>
              <th width="10%">产品</th>
              <th width="10%">买/卖</th>
              <th>手数</th>
            </tr>
        </thead>
        <tbody>                               
            <tr>
                <td>
                    <div class="acc-pbox">
                        <p>13***78</p>
                        <div class="acc-dian">...</div>
                        <p class="dn">13***78</p>
                        <p class="dn">13***78</p>
                    </div>
                    
                </td>
                <td><span>10:00:01</span></td>
                <td>1192.32</td>
                <td><strong>1198.26</strong></td>
                <td>建仓</td>
                <td><span>伦敦金</span></td>
                <td>买</td>
                <td>0.5</td>
            </tr>
            <tr>
                <td>13***78</td>
                <td><span>10:00:01</span></td>
                <td>1192.32</td>
                <td><strong>1198.26</strong></td>
                <td>建仓</td>
                <td><span>伦敦金</span></td>
                <td>买</td>
                <td>0.5</td>
            </tr>
            <tr>
                <td>13***78</td>
                <td><span>10:00:01</span></td>
                <td>1192.32</td>
                <td><strong>1198.26</strong></td>
                <td>建仓</td>
                <td><span>伦敦金</span></td>
                <td>买</td>
                <td>0.5</td>
            </tr>
            <tr>
                <td>13***78</td>
                <td><span>10:00:01</span></td>
                <td>1192.32</td>
                <td><strong>1198.26</strong></td>
                <td>建仓</td>
                <td><span>伦敦金</span></td>
                <td>买</td>
                <td>0.5</td>
            </tr>
            <tr>
                <td>13***78</td>
                <td><span>10:00:01</span></td>
                <td>1192.32</td>
                <td><strong>1198.26</strong></td>
                <td>建仓</td>
                <td><span>伦敦金</span></td>
                <td>买</td>
                <td>0.5</td>
            </tr>
            <tr>
                <td>13***78</td>
                <td><span>10:00:01</span></td>
                <td>1192.32</td>
                <td><strong>1198.26</strong></td>
                <td>建仓</td>
                <td><span>伦敦金</span></td>
                <td>买</td>
                <td>0.5</td>
            </tr>
               <tr>
                <td width="15%">13***78</td>
                <td width="15%"><span>10:00:01</span></td>
                <td width="15%">1192.32</td>
                <td width="15%"><strong>1198.26</strong></td>
                <td width="10%">建仓</td>
                <td width="10%"><span>伦敦金</span></td>
                <td width="10%">买</td>
                <td>0.5</td>
            </tr>
            <tr>
                <td>13***78</td>
                <td><span>10:00:01</span></td>
                <td>1192.32</td>
                <td><strong>1198.26</strong></td>
                <td>建仓</td>
                <td><span>伦敦金</span></td>
                <td>买</td>
                <td>0.5</td>
            </tr>
            <tr>
                <td>13***78</td>
                <td><span>10:00:01</span></td>
                <td>1192.32</td>
                <td><strong>1198.26</strong></td>
                <td>建仓</td>
                <td><span>伦敦金</span></td>
                <td>买</td>
                <td>0.5</td>
            </tr>
        </tbody>
    </table>

    <script type="text/javascript" src="/demo/js/jq.js"></script>
    <script type="text/javascript">
        $(function(){
            $(".acc-pbox").click(function(){
                $(this).children("p:gt(0)").slideToggle();
                $(".acc-dian").slideToggle();
            })
        })
    </script>
</body>
</html>

有需求的童鞋,可以参考下。

温馨提示:本文作者系流泪的石头 ,经Web前端之家编辑修改或补充,转载请注明出处和本文链接:
https://jiangweishan.com/article/table12312312312312313.html

网友评论文明上网理性发言 已有0人参与

发表评论:

最新留言

  • Web前端之家

    可以的,有什么问题吗?...

  • 访客

    我就试试的...

  • a235

    不能比啊,老外赚钱就是多!...

  • Web前端之家

    备份是必须的,避免麻烦!...

  • a235

    总结得不错,正好用到,提前备份还是最靠谱啊!...

  • Web前端之家

    谢谢支持,请持续关注Web前端之家!...

  • 访客

    文章很棒,做即时通讯也可以试试【GoEasy】这个框架,官网文档详细还提供了各种demo,大大降低了...

  • Web前端之家

    是的,等其他人验证没问题再装吧,总会有第一个吃螃蟹的人,哈哈!!...

首页|JavaScript|HTML|HTML4|HTML5|CSS3|开发工具|性能优化|移动开发|前端教程|性能优化|开发工具|酷站欣赏|UI设计|前端教程

Copyright © 2021 Web前端之家(www.jiangweishan.com) 版权所有 All Rights Reserved.
粤ICP备12067512号-1

Copyright Your WebSite.Some Rights Reserved.

Powered By Z-BlogPHP 1.7.1