标题点击切换效果

	<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;在添加选中的样式。

  实现效果:

转载于:https://www.cnblogs.com/homle/p/8228921.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值