基于jQuery实现仿百度首页选项卡切换效果 - Web前端
作者:98wpeu发布时间:2026-08-12分类:网页前端技术浏览:5
导读:以下代码比较简单,所以没给大家附太多的注释,有问题欢迎给我留言,具体详情请看下文代码吧。先给大家展示下效果图:代码如下:<!DOCtypehtml>&l...
以下代码比较简单,所以没给大家附太多的注释,有问题欢迎给我留言,具体详情请看下文代码吧。
先给大家展示下效果图:

代码如下:
<!DOCtype html>
<HTML>
<head>
<meta http-eqUIv="Content-Type" content="text/html; charset=utf-8" />
<title>JQuery仿百度首页选项卡切换效果 - 何问起</title>
<base target="_blank" />
<style type="text/CSS">
body {
background: url(HTTP://hovertree.com/texiao/jQuery/71/images/65.jpg) no-repeat fixed center center;
}
.hovertreepage .clear {
clear: both;
}
.hovertreepage {
margin: 200px auto 0 auto;
width: 700px;
height: 300px;
}
.hovertreepage .left, .hovertreepage .right {
float: left;
}
.hovertreepage .nav-back {
width: 60px;
height: 300px;
background: #000;
opacity: .3;
filter: alpha(opacity=30);
}
.hovertreepage .nav {
position: relative;
margin-top: -300px;
width: 60px;
text-align: center;
font-size: 14px;
font-family: "微软雅黑";
color: #fff;
}
.hovertreepage .nav div {
height: 32px;
line-height: 28px;
cursor:pointer;
}
.hovertreepage .nav div.on {
background: #0094ea;
}
.hovertreepage .right {
width: 620px;
height: 300px;
margin-left: 20px;
}
.hovertreepage .content-back {
width: 620px;
height: 300px;
background: #fff;
opacity: .3;
}
.hovertreepage .content {
position: relative;
width: 600px;
height: 280px;
margin-top: -300px;
padding: 10px;
overflow: hidden;
}
.hovertreepage .content a{color:blue;}
.hovertreepage .content div {
width: 600px;
height: 280px;
margin-bottom: 10px;
background: #fff;
}
</style>
</head>
<body>
<div class="hovertreepage">
<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 <a href="http://hovertree.com">首页</a> <a href="http://hovertree.com/texiao/">特效</a> <a href="http://hovertree.com/h/bjaf/n781jmfy.htm">原文</a>
</div>
<div>2 </div>
<div>3 <a href="http://hovertree.com/texiao/jquery/70/color.htm">服装店风云</a> 自从接触编程以后,兴趣就一直有增无减。</div>
<div>4 <a href="http://hovertree.com/h/bjaf/ati6k7yk.htm">jquery全部版本下载</a>
时间就是金钱,效率就是生命。
</div>
<div>5 <a href="http://hovertree.com/texiao/html5/30/"><img src="http://hovertree.com/hvtimg/bjafjd/wmt3mxd7.png" alt="孙悟空" /></a></div>
</div>
</div>
<div class="clear"></div>
</div>
<script type="text/javascript" src="http://down.hovertree.com/JQuery/jquery-1.12.3.min.JS"></script>
<script type="text/JavaScript">
$(".hovertreepage .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);
$(".hove"+"rtreepage .nav div").removeClass("on");
$(".hovertreepage .nav div").eq(index).addClass("on");
$(".hovertreepage .content div:eq(0)").stop().Animate({ "margin-top": l }, 500);
});
</script>
</body>
</html>
以上内容是小编给大家介绍的基于jQuery实现仿百度首页选项卡切换效果,希望对大家有所帮助!
相关推荐
- 通过Ajax使用FormData对象无刷新上传文件方法 - Web前端
- PHP+jquery+ajax实现分页 - Web前端
- jquery+css3问卷答题卡翻页动画效果示例 - Web前端
- EasyUI 中combotree 默认不能选择父节点的实现方法 - Web前端
- jQuery Validate验证框架详解(推荐) - Web前端
- BootStrap中按钮点击后被禁用按钮的最佳实现方法 - Web前端
- 针对后台列表table拖拽比较实用的jquery拖动排序 - Web前端
- jQuery无刷新上传之uploadify3.1简单使用 - Web前端
- Jquery组件easyUi实现表单验证示例 - Web前端
- 获取jqGrid中选择的行的数据 - 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属性


