Jquery的Tabs内容轮换效果实现代码,几行搞定 - Web前端
作者:98wpeu发布时间:2026-10-02分类:网页前端技术浏览:87
导读:复制代码代码如下:<!DOCtypehtmlPUBLIC"-//W3C//DTDxhtml1.0Transitional//EN""http://www.w3....
复制代码 代码如下:
<!DOCtypehtml PUBLIC "-//W3C//DTD xhtml 1.0 Transitional//EN" "http://www.w3.org/TR/xHTML1/DTD/xhtml1-transitional.dtd">
<html xmlns="HTTP://www.w3.org/1999/xhtml">
<head>
<title>JQuery的tabs内容轮换效果实现代码,几行搞定</title>
<script language="javascript" type="text/JavaScript" src="/Scripts/jQuery-1.4.4.min.JS"></script>
<style type="text/CSS">
* { margin:0; padding:0;}
body { font:12px Verdana, Geneva, sans-serif; color:#404040;}
.TABs { margin:10px 0 0 20px; width:360px; position:relative; overflow:hidden; height:1%; height:160px;}
.tabs span { z-index:2; font-size:12px; border:1px solid #d5d5d5; width:95px; height:25px; line-height:25px; text-align:center; float:left; margin-right:5px; cursor:pointer;}
span.active { background-position:0 -25px; background-color:#d5d5d5;}
#tab-01, #tab-02, #tab-03 { position:absolute; top:26px; left:0; width:338px; padding:10px; height:93px; border:1px solid #d5d5d5; z-index:1;}
#tab-02, #tab-03 { display:none;}
</style>
<script type="text/Javascript">
$(document).ready(function () {
$('.tabs span').mouSEOver(function () {
//div隐藏
$('.tabs div').hide();
//查找.tabs span同辈元素span 后面紧邻的同辈元素div显示
$(this).siblings('span').removeclass('active').end().addClass('active').next('div').show();
});
});
</script>
</head>
<body>
<div class="tabs">
<!-- 默认第一个tab为激活状态 -->
<span class="active">热点新闻</span>
<div id="tab-01">news</div>
<span>娱乐新闻</span>
<div id="tab-02">enteriment</div>
<span>就业形势</span>
<div id="tab-03">jobs</div>
</div>
</body>
</html>
<!DOCtypehtml PUBLIC "-//W3C//DTD xhtml 1.0 Transitional//EN" "http://www.w3.org/TR/xHTML1/DTD/xhtml1-transitional.dtd">
<html xmlns="HTTP://www.w3.org/1999/xhtml">
<head>
<title>JQuery的tabs内容轮换效果实现代码,几行搞定</title>
<script language="javascript" type="text/JavaScript" src="/Scripts/jQuery-1.4.4.min.JS"></script>
<style type="text/CSS">
* { margin:0; padding:0;}
body { font:12px Verdana, Geneva, sans-serif; color:#404040;}
.TABs { margin:10px 0 0 20px; width:360px; position:relative; overflow:hidden; height:1%; height:160px;}
.tabs span { z-index:2; font-size:12px; border:1px solid #d5d5d5; width:95px; height:25px; line-height:25px; text-align:center; float:left; margin-right:5px; cursor:pointer;}
span.active { background-position:0 -25px; background-color:#d5d5d5;}
#tab-01, #tab-02, #tab-03 { position:absolute; top:26px; left:0; width:338px; padding:10px; height:93px; border:1px solid #d5d5d5; z-index:1;}
#tab-02, #tab-03 { display:none;}
</style>
<script type="text/Javascript">
$(document).ready(function () {
$('.tabs span').mouSEOver(function () {
//div隐藏
$('.tabs div').hide();
//查找.tabs span同辈元素span 后面紧邻的同辈元素div显示
$(this).siblings('span').removeclass('active').end().addClass('active').next('div').show();
});
});
</script>
</head>
<body>
<div class="tabs">
<!-- 默认第一个tab为激活状态 -->
<span class="active">热点新闻</span>
<div id="tab-01">news</div>
<span>娱乐新闻</span>
<div id="tab-02">enteriment</div>
<span>就业形势</span>
<div id="tab-03">jobs</div>
</div>
</body>
</html>
相关推荐
- Vue3中watch监听props时为什么要用deep?怎么正确使用? - Web前端
- Vue3中watch如何监听v-model绑定的值? - Web前端
- Vue3怎么监听localStorage变化?这篇文章讲清楚了 - Web前端
- Vue3秒表的基础结构怎么搭? - Web前端
- Vue Multiselect 3.0.0有哪些值得关注的新变化? - Web前端
- Vue开发:defineComponent和watch的基础关系得先搞明白 - Web前端
- Vue 2.0和3.0有哪些核心差异?开发者该如何选择? - Web前端
- Vue3中用Hooks封装watch时常见问题有哪些?怎么避坑? - Web前端
- Vue3的Watch Composable到底怎么用?一篇讲透核心用法与避坑指南 - Web前端
- Nuxt 3.5升级Vue 3.5后,前端开发有哪些新变化? - Web前端
- 网页前端技术排行
-
- 1[Web前端]用javascript实现默认图片替代未显示的图片 - Web前端
- 2分析Iconfont-阿里巴巴矢量常用图标库 - Web前端
- 3jQuery实例教程:制作网页中可折叠的面板 - Web前端
- 4【第六章】Foundation之按钮和下拉功能 - Web前端
- 5基于jquery的滚动条滚动固定div(附演示下载) - Web前端
- 6分享精心挑选的12款优秀jQuery Ajax分页插件和教程 - Web前端
- 7jQuery实现鼠标移到元素上动态提示消息框效果 - Web前端
- 8在Mac/PC上远程调试iPhone/iPad上的网页 - Web前端
- 9jQuery编写widget的一些技巧分享 - 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属性


