jQuery简单Tabs标签插件

 

/* 
jQuery简单Tabs标签插件

by ~Wang

html:
	<div id="tabs">
		<div class="tab_title">
			<ul>
				<li class="li_curr">Tabs效果</li>
				<li>jQuery插件</li>
			</ul>
		</div>
		<div class="tab_content">
			<ul>
				<li>是一个简单易用的 jQuery 的 Tab 插件。 </li>
				<li>jerichoTab是一款模拟 firefox 标签页的插件, </li>
				<li>jQuery UI 1.7.2 - ui.core.js and ui.tabs.js 在线演示...</li>
				<li>JQuery TabContainer Theme-一个JQuery的Tab选项卡内容</li>
				<li>jQuery Smooth Tabs是一个简单易于使用的插件,</li>
			</ul>
			<ul style="display:none">
				<li>KandyTabs选项卡以HTML标准及用户体验为指导思想</li>
				<li>有7种效果2种样式可供选择。tabSwitch可以自动或手动播放每一个tab/slide。</li>
				<li>wdScrollTab is a tab panel which has ability to scroll for tabs that do not fit on the page</li>
				<li>A simple jquery plugin that does auto tab</li>
			</ul>
		</div>
	</div>
css:
	* { margin:0; padding:0; }
	ul { list-style:none; }
	body { color:#333; font-size:12px; }
	
	#tabs { margin:100px auto auto auto; width:500px; }
	#tabs .tab_title { width:500px; }
	#tabs .tab_title ul { width:500px; overflow:hidden; zoom:1; }
	#tabs .tab_title ul li { float:left; margin-right:2px; width:80px; height:26px; background-color:#EEE; border:1px solid #DDD; border-bottom:none; line-height:26px; text-align:center; }
	#tabs .tab_title ul .li_curr { background-color:#FFF; }
	#tabs .tab_content { padding:4px; width:490px; border:1px solid #DDD; border-top:none; }
	#tabs .tab_content ul { padding:0 5px; width:480px; height:140px; }
	#tabs .tab_content ul li { width:480px; height:28px; line-height:28px; overflow:hidden; }
js:
	$( function() {
		$('#tabs').wTabs();
	});
 */

( function($) {
	$.fn.wTabs = function() {
		var li_curr = 'li_curr';
		//定义当前标签样式
		var curr_index = 0;
		//当前激活标签序号
		
		var tab_title = $('div:eq(0)', this);
		var tab_content = $('div:eq(1)', this);
		//定义对象
		
		$('ul li', tab_title).mouseover( function(){
			curr_index = $(this).index();
			//定义当前索引
			$('ul li', tab_title).removeClass(li_curr);
			$(this).addClass(li_curr);
			//激活当前标签
			$('ul', tab_content).hide();
			$('ul:eq('+curr_index+')', tab_content).show();
			//显示当前内容
		});
	}
})(jQuery);

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值