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

好吧,话不多说,直接上干货代码:
<!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>有需求的童鞋,可以参考下。




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