zoukankan      html  css  js  c++  java
  • 标题点击切换效果

    	<body>
    		<div class="bougthDiv">
    			<div class="orderType">
    				<div class="selectedOrderType"><a href="#nowhere" orderstatus="all">所有订单</a></div>
    				<div class=""><a href="#nowhere" orderstatus="waitPay">待付款</a></div>
    				<div class=""><a href="#nowhere" orderstatus="waitDelivery">待发货</a></div>
    				<div class=""><a href="#nowhere" orderstatus="waitConfirm">待收货</a></div>
    				<div class=""><a href="#nowhere" orderstatus="waitReview" class="noRightborder">待评价</a></div>
    				<div class="orderTypeLastOne"><a class="noRightborder"></a></div>
    			</div>
    			<div style="clear: both;"></div>
    			<div class="orderListTitle"></div>
    			<div class="orderListItem">
    				<table oid="946" orderstatus="waitReview" class="orderListItemTable" style="display: table;"></table>
    				<table oid="945" orderstatus="waitConfirm" class="orderListItemTable" style="display: table;"></table>
    				<table oid="944" orderstatus="waitDelivery" class="orderListItemTable" style="display: table;"></table>
    				<table oid="943" orderstatus="waitPay" class="orderListItemTable" style="display: table;"></table>
    			</div>
    		</div>
    		<script type="text/javascript">
    			$(function(){
    				$("a[orderstatus]").click(function(){
    					var orderstatus = $(this).attr("orderstatus");
    					if(orderstatus == 'all'){
    						$('table[orderstatus]').show();
    					}
    					else{
    						$('table[orderstatus]').hide();
    						$('table[orderstatus='+orderstatus+']').show()
    					}
    					$('div.orderType div').removeClass("selectedOrderType");
    					$(this).parent("div").addClass("selectedOrderType");
    				});
    			});
    		</script>
    	</body>
    

      使用jquery实现的标题切换效果,当点击标题中的某个链接时,先获取到链接的orderstatus值,当orderstatus值为all时,显示全部table;当点击其他时,先隐藏所有的table,在显示当前链接对应的table;在添加选中的样式。

      实现效果:

  • 相关阅读:
    oracle查询哪些sp修改了某些表
    asp.net mvc
    更新计算机驱动
    instr函数的用法
    UNION ALL UNION
    Python机器学习ch02 代码学习2
    Python机器学习 ch02代码学习1
    转载Python切片(小知识点)
    FMCW部分资料连接
    Python基础25 异常堆栈跟踪,释放资源,自定义异常和主动抛出
  • 原文地址:https://www.cnblogs.com/homle/p/8228921.html
Copyright © 2011-2022 走看看