基于jQuery实现的仿百度首页滑动选项卡效果代码 - Web前端
作者:98wpeu发布时间:2026-08-13分类:网页前端技术浏览:6
导读:本文实例讲述了基于JQuery实现的仿百度首页滑动选项卡效果代码。分享给大家供大家参考,具体如下:今天给大家分享一款基于jQuery的仿百度首页滑动选项卡,可实现tab选项卡内容...
本文实例讲述了基于JQuery实现的仿百度首页滑动选项卡效果代码。分享给大家供大家参考,具体如下:
今天给大家分享一款基于jQuery的仿百度首页滑动选项卡,可实现tab选项卡内容上下翻滚切换的功能。这款选项卡适用浏览器有:ie8、360、firefox、Chrome、Safari、Opera、傲游、搜狗、世界之窗。效果图如下:

在线演示地址如下:
http://demo.jb51.net/js/2015/jquery-f-baidu-hd-nav-style-codes/
完整实例代码代码点击此处本站下载。
html代码:
<div class="mAIn-page">
<div class="left">
<div class="nav-back">
</div>
<div class="nav">
<div class="on">
导航</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程序设计有所帮助。
相关推荐
- Jquery zTree 树控件异步加载操作 - Web前端
- jQuery实现的精美平滑二级下拉菜单效果代码 - Web前端
- 酷炫jQuery全屏3D焦点图动画效果 - Web前端
- jQuery插件Validate实现自定义表单验证 - Web前端
- jQuery+canvas实现的球体平抛及颜色动态变换效果 - Web前端
- jQuery+canvas实现简单的球体斜抛及颜色动态变换效果 - Web前端
- jqueryMobile使用示例分享 - Web前端
- 深入学习jQuery Validate表单验证 - Web前端
- jQuery插件Validate实现自定义表单验证 - Web前端
- jQuery+canvas实现的球体平抛及颜色动态变换效果 - Web前端
- 网页前端技术排行
-
- 1[Web前端]用javascript实现默认图片替代未显示的图片 - Web前端
- 2分析Iconfont-阿里巴巴矢量常用图标库 - Web前端
- 3jQuery实例教程:制作网页中可折叠的面板 - Web前端
- 4基于jquery的滚动条滚动固定div(附演示下载) - Web前端
- 5【第六章】Foundation之按钮和下拉功能 - Web前端
- 6jQuery编写widget的一些技巧分享 - Web前端
- 7分享精心挑选的12款优秀jQuery Ajax分页插件和教程 - Web前端
- 8jQuery实现鼠标移到元素上动态提示消息框效果 - Web前端
- 9在Mac/PC上远程调试iPhone/iPad上的网页 - Web前端
- 最近发表
-
- WordPress随机显示特色图片插件:Random Post Thumbnails
- KeePass实现Chrome浏览器自动填充密码方法一
- LNMP一键包nginx 301强制跳转到https教程
- KeePass实现Chrome浏览器自动填充密码方法二
- #建站# 免费的VPS管理软件Xshell8/Xftp8中文版下载
- 使用Xshell 8连接VPS教程_电脑登录vps的方法
- WordPress评论界面添加烟花????效果
- 不同浏览器书签同步方案:坚果云+Floccus_详细使用教程
- iOS端KeePassXC客户端APP:Strongbox Password Safe
- 给WordPress评论中的Gravatar头像图片添加ALT属性


