4款jQuery實用的響應式選項卡tab切換代碼



190 759 254



特效描述:jQuery 實用響應式選項卡 選項卡tab切換,四種酷炫的tab切換代碼,jQuery響應式選項卡切換。

代碼結構

1. 引入CSS

<link rel="stylesheet" type="text/css" href="css/demo.css">
<link rel="stylesheet" href="assets/css/tabs/tabs-basic.css">

2. 引入JS

<script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>

3. HTML代碼

	<header class="htmleaf-header">
		<div class="htmleaf-demo center">
		  <a href="index.html" class="current">基本</a>
		  <a href="index2.html">彩色</a>
		  <a href="index3.html">下劃線</a>
		  <a href="index4.html">垂直</a>
		</div>
	</header>
	<div class="tabs-basic">
		<ul>
			<li>
				<a class="tab-active" data-index="0" href="#">First tab</a>
			</li>
			<li>
				<a data-index="1" href="#">Second tab</a>
			</li>
			<li>
				<a data-index="2" href="#">Third tab</a>
			</li>
		</ul>
		<div class="tabs-content-placeholder">
			<div class="tab-content-active">
				<p>Lorem ipsum dolor ist amet, consectetur adipiscing elit. Suspendisse molestie volutpat consectetur. Class aptent taciti sociosqu ad litora torquent per conubia nostra.</p>
				<img src="assets/images/pictures/bahnhoff.jpg" alt="Banhoff">
			</div>
			<div>
				<p>Lorem ipsum dolor ist amet, consectetur adipiscing elit. Suspendisse molestie volutpat consectetur. Class aptent taciti sociosqu ad litora torquent per conubia nostra.</p>
				<img src="assets/images/pictures/colosseum.jpg" alt="Colosseum">
			</div>
			<div>
				<p>Lorem ipsum dolor ist amet, consectetur adipiscing elit. Suspendisse molestie volutpat consectetur. Class aptent taciti sociosqu ad litora torquent per conubia nostra.</p>
				<img src="assets/images/pictures/sands-of-life.jpg" alt="Sands of Life">
			</div>
		</div>
	</div>
	<script type="text/javascript">
        $(document).ready(function() {
            var widget = $('.tabs-basic');
            var tabs = widget.find('ul a'),
                content = widget.find('.tabs-content-placeholder > div');
            tabs.on('click', function (e) {
                e.preventDefault();
                // Get the data-index attribute, and show the matching content div
                var index = $(this).data('index');
                tabs.removeClass('tab-active');
                content.removeClass('tab-content-active');
                $(this).addClass('tab-active');
                content.eq(index).addClass('tab-content-active');
            });
        });
    </script>



用戶評論
大牛,別默默的看了,快登錄幫我點評一下吧!:)      登錄 | 注冊


熱門標簽: 滾動切換 滾動條切換 滑動選項卡 滑動切換 選項卡切換 選項卡 切換 tab切換 頁面切換 選項卡插件 切換插件 滑動手風琴 選項卡自動切換
?
×
×

注冊

官方QQ群

掃描上面二維碼加微信群

官方QQ群

jQuery/js討論群
群號:642649996
Css3+Html5討論群
群號:322131262

加群請備注:從官網了解到

老夫子电子