国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

基于jQuery實(shí)現(xiàn)的仿百度首頁滑動(dòng)選項(xiàng)卡效果代碼

2019-11-20 11:15:40
字體:
供稿:網(wǎ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.VeVB.COm/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);});

希望本文所述對大家jQuery程序設(shè)計(jì)有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 盐津县| 沅江市| 松桃| 滨州市| 盘锦市| 伊金霍洛旗| 镇雄县| 昌宁县| 石河子市| 兴义市| 宁国市| 库伦旗| 新乡市| 花莲县| 宝山区| 县级市| 闸北区| 香河县| 英吉沙县| 杂多县| 绥德县| 沙坪坝区| 普定县| 大同市| 新郑市| 友谊县| 澄城县| 宁安市| 延寿县| 丰都县| 蒙自县| 鸡泽县| 隆尧县| 东港市| 博兴县| 大埔区| 安福县| 谢通门县| 新津县| 盐津县| 务川|