基于jQuery實(shí)現(xiàn)的仿百度首頁滑動(dòng)選項(xiàng)卡效果代碼
本文實(shí)例講述了基于jQuery實(shí)現(xiàn)的仿百度首頁滑動(dòng)選項(xiàng)卡效果代碼。分享給大家供大家參考,具體如下:
今天給大家分享一款基于jQuery的仿百度首頁滑動(dòng)選項(xiàng)卡,可實(shí)現(xiàn)tab選項(xiàng)卡內(nèi)容上下翻滾切換的功能。這款選項(xiàng)卡適用瀏覽器有:IE8、360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗。效果圖如下:

在線演示地址如下:
http://demo.jb51.net/js/2015/jquery-f-baidu-hd-nav-style-codes/
完整實(shí)例代碼代碼點(diǎn)擊此處本站下載。
html代碼:
<div class="main-page">
<div class="left">
<div class="nav-back">
</div>
<div class="nav">
<div class="on">
導(dǎo)航</div>
<div>
新聞</div>
<div>
世界杯</div>
<div>
音樂</div>
<div>
彩票</div>
</div>
</div>
<div class="right">
<div class="content-back">
</div>
<div class="content">
<div>
站長素材1</div>
<div>
站長素材2</div>
<div>
站長素材3</div>
<div>
站長素材4</div>
<div>
站長素材5</div>
</div>
</div>
<div class="clear">
</div>
</div>
css代碼:
body
{
background: url(images/65.jpg) no-repeat fixed center center;
}
.clear
{
clear: both;
}
.main-page
{
margin: 200px auto 0 auto;
width: 700px;
height: 300px;
}
.main-page .left, .main-page .right
{
float: left;
}
.main-page .nav-back
{
width: 60px;
height: 300px;
background: #000;
opacity: .3;
filter: alpha(opacity=30);
}
.main-page .nav
{
position: relative;
margin-top: -300px;
width: 60px;
text-align: center;
font-size: 14px;
font-family: "微軟雅黑";
color: #fff;
}
.main-page .nav div
{
height: 32px;
line-height: 28px;
}
.main-page .nav div.on
{
background: #0094ea;
}
.main-page .right
{
width: 620px;
height: 300px;
margin-left: 20px;
}
.main-page .content-back
{
width: 620px;
height: 300px;
background: #fff;
opacity: .3;
}
.main-page .content
{
position: relative;
width: 600px;
height: 280px;
margin-top: -300px;
padding: 10px;
overflow: hidden;
}
.main-page .content div
{
width: 600px;
height: 280px;
margin-bottom: 10px;
background: #fff;
}
js代碼:
$(".main-page .nav div").mouseenter(function () {
var $this = $(this);
var index = $this.index();
}).mouseleave(function () {
var $this = $(this);
var index = $this.index();
}).click(function () {
var $this = $(this);
var index = $this.index();
var l = -(index * 290);
$(".main-page .nav div").removeClass("on");
$(".main-page .nav div").eq(index).addClass("on");
$(".main-page .content div:eq(0)").stop().animate({ "margin-top": l }, 500);
});
希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。
- jQuery實(shí)現(xiàn)的經(jīng)典滑動(dòng)門效果
- jQuery實(shí)現(xiàn)自動(dòng)切換播放的經(jīng)典滑動(dòng)門效果
- jquery僅用6行代碼實(shí)現(xiàn)滑動(dòng)門效果
- jquery實(shí)現(xiàn)標(biāo)題字體變換的滑動(dòng)門菜單效果
- jQuery實(shí)現(xiàn)類似滑動(dòng)門切換效果的層切換
- 基于jquery自己寫tab滑動(dòng)門(通用版)
- EasySlider 基于jQuery功能強(qiáng)大簡單易用的滑動(dòng)門插件
- jQuery實(shí)現(xiàn)TAB選項(xiàng)卡切換特效簡單演示
- jquery實(shí)現(xiàn)具有嵌套功能的選項(xiàng)卡
- jquery實(shí)現(xiàn)經(jīng)典的淡入淡出選項(xiàng)卡效果代碼
- jQuery實(shí)現(xiàn)仿騰訊迷你首頁選項(xiàng)卡效果代碼
- jQuery實(shí)現(xiàn)的Tab滑動(dòng)選項(xiàng)卡及圖片切換(多種效果)小結(jié)
- jQuery實(shí)現(xiàn)的多滑動(dòng)門,多選項(xiàng)卡效果代碼
相關(guān)文章
DropDownList實(shí)現(xiàn)可輸入可選擇(兩種版本可選)
本篇文章主要介紹了DropDownList實(shí)現(xiàn)可輸入可選擇的具體實(shí)現(xiàn)代碼,并附上兩種版本(js版本和jquery版本),可供大家選擇。有需要的朋友可以參考下2016-12-12
jQuery select自動(dòng)選中功能實(shí)現(xiàn)方法分析
這篇文章主要介紹了jQuery select自動(dòng)選中功能,結(jié)合實(shí)例形式分析了jQuery實(shí)現(xiàn)select響應(yīng)與級(jí)聯(lián)菜單顯示相關(guān)功能與操作技巧,需要的朋友可以參考下2016-11-11
jQuery實(shí)現(xiàn)帶滾動(dòng)線條導(dǎo)航效果的方法
這篇文章主要介紹了jQuery實(shí)現(xiàn)帶滾動(dòng)線條導(dǎo)航效果的方法,分析了帶滾動(dòng)條導(dǎo)航效果的實(shí)現(xiàn)原理與相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-01-01
jquery通過visible來判斷標(biāo)簽是否顯示或隱藏
這篇文章主要介紹了jquery如何判斷標(biāo)簽是否顯示或隱藏,使用到了visible屬性,大家可以學(xué)習(xí)下2014-05-05
關(guān)于jquery中全局函數(shù)each使用介紹
jquery 包含了兩個(gè) each 一個(gè)是 $().each 另一個(gè)是 $.each 區(qū)別就在于前一個(gè)是 jquery對(duì)象的內(nèi)置函數(shù) 而后一個(gè) 這是對(duì)象的遍歷函數(shù)2013-12-12

