ajax实现类似百度首页的,基于jQuery实现的仿百度首页滑动选项卡效果代码

本文实例讲述了基于jQuery实现的仿百度首页滑动选项卡效果代码。分享给大家供大家参考,具体如下:

今天给大家分享一款基于jQuery的仿百度首页滑动选项卡,可实现tab选项卡内容上下翻滚切换的功能。这款选项卡适用浏览器有:IE8、360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗。效果图如下:

15058142521.png?20151016153533

在线演示地址如下:

完整实例代码代码点击此处本站下载。

站长素材1

站长素材2

站长素材3

站长素材4

站长素材5

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程序设计有所帮助。

总结

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值