1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > js实现仿百度风云榜可重复多次调用的TAB切换选项卡效果【javascript】

js实现仿百度风云榜可重复多次调用的TAB切换选项卡效果【javascript】

时间:2020-01-11 18:13:58

相关推荐

js实现仿百度风云榜可重复多次调用的TAB切换选项卡效果【javascript】

web前端|js教程

js,仿百度风云榜,重复多次调用,TAB切换选项卡

web前端-js教程

本文实例讲述了js实现仿百度风云榜可重复多次调用的TAB切换选项卡效果。分享给大家供大家参考。具体如下:

昊海源码,vscode输出变成乱码,ubuntu 安装qq,模拟tomcat,sqlite高频读写,网页设计中应用了哪些方法,sql怎么还原数据库,serv-u创建ftp服务器,新浪邮箱上传插件,前端新开发都用框架吗,爬虫道德,php工厂模式,seo关键词技巧,springboot 协议,hot标签素材,网站后台 批量上传,java代码如何获取网页的音乐链接,网点模板,织梦后台登录成功返回到登录,获取当前页面url js,extjs后台管理系统,禁忌搜索算法程序lzw

这是一款可在同一页面中多次调用的TAB选项卡代码,仿百度风云榜的TAB切换效果,用到了几张修饰图片,请顺着代码下载所需的图片,然后上传到你的网站中,修改代码内的路径就可以用了。

net酒店预订系统源码,vscode显示模拟器,ubuntu安装su,tomcat配置出现404,爬虫抓简历,php qq 发邮件,新手怎么做seo 引流,国外flash网站模板,手机功能牌模板lzw

运行效果截图如下:

c 医药销售管理软件源码,ubuntu克隆修改网卡,tomcat绝对路径相对路径,创投网爬虫,PHP程序存储在以下那个目录下,资深seo大神lzw

在线演示地址如下:

/js//js-f-baidu-style-tab-cha-codes/

具体代码如下:

仿百度风云榜TAB切换body,div,h5,ul,li{margin:0;padding:0;}body{font:12px/1.5 Arial;}li{list-style:none;}a:link,a:visited{color:#333;text-decoration:none;}a:hover{text-decoration:underline;}#wrap{width:836px;border:3px solid #1972C0;border-width:3px 0;margin:10px auto;}#list{overflow:hidden;zoom:1;margin-left:-10px;}#wrap .item{display:inline;float:left;width:270px;padding-bottom:10px;border:1px solid #EBEBEB;margin:10px 0 10px 10px;}#wrap .item .tab{position:relative;height:25px;border-bottom:1px solid #CCC;margin:8px;}#wrap .item .tab h5{position:absolute;left:10px;font-size:14px;}#wrap .item .tab .switchBtn{position:absolute;top:3px;right:0;}#wrap .item .tab .switchBtn a{float:left;width:15px;height:15px;margin-left:5px;overflow:hidden;text-indent:-999px;background:url(images/icon_arr.jpg) no-repeat;outline:none;}#wrap .item .tab .switchBtn a.prev{background-position:0 -25px;}#wrap .item .tab .switchBtn a.prevNot{background-position:0 0;cursor:default;}#wrap .item .tab .switchBtn a.next{background-position:right -25px;}#wrap .item .tab .switchBtn a.nextNot{background-position:right 0;cursor:default;}#wrap .item .tab ul{position:absolute;top:-2px;left:50px;width:160px;height:28px;overflow:hidden;}#wrap .item .tab ul li{float:left;cursor:pointer;line-height:26px;padding:0 8px;}#wrap .item .tab ul li.current{cursor:text;color:#E45E2E;font-weight:700;border:1px solid #CCC;border-bottom-color:#FFF;}#wrap .item .items{display:none;background:url(images/icon_num.jpg) 15px 4px no-repeat;padding:0 15px;}#wrap .item .items a{color:#3A64B0;}#wrap .item .items li{height:24px;line-height:24px;padding-left:20px;border-bottom:1px solid #EBEBEB;}#wrap .item .btn{height:22px;margin-top:10px;}#wrap .item .btn a{float:right;width:74px;height:22px;overflow:hidden;margin-right:15px;text-indent:-9999px;background:url(images/icon_btn.jpg) no-repeat;}#wrap .item .btn a:hover{background-position:0 -22px;}#copyright{color:#9A9A9A;text-align:center;}#copyright a{color:#FFF;padding:2px 5px;border-radius:10px;background:#9A9A9A;}var fgm = { $: function(id) { return typeof id === "object" ? id : document.getElementById(id); }, $$: function(tagName, oParent) { return (oParent || document).getElementsByTagName(tagName); }, $$$: function(className, element, tagName) { var i = 0, aClass = [], reClass = new RegExp("(^|\\s)" + className + "(\\s|$)"), aElement = fgm.$$(tagName || "*", element || document); for (i = 0; i < aElement.length; i++) reClass.test(aElement[i].className) && aClass.push(aElement[i]); return aClass; }, index: function(element) { var aChildren = element.parentNode.children, i; for(i = 0; i < aChildren.length; i++) if(aChildren[i] === element) return i; return -1; }, on: function(element, type, handler) { return element.addEventListener ? element.addEventListener(type, handler, !1) : element.attachEvent("on" + type, handler); }, bind: function(object, handler) { return function() { return handler.apply(object, arguments); }; }};function Tab(id) { var that = this; this.obj = fgm.$(id); this.oTab = fgm.$$$("tab", this.obj)[0]; this.aTab = fgm.$$("li", this.oTab); this.oSwitch = fgm.$$$("switchBtn", this.oTab)[0]; this.oPrev = fgm.$$("a", this.oSwitch)[0]; this.oNext = fgm.$$("a", this.oSwitch)[1]; this.aItems = fgm.$$$("items", this.obj); this.iNow = 0; fgm.on(this.oSwitch, "click", fgm.bind(this, this.fnClick)); fgm.on(this.oTab, "mouseover", fgm.bind(this, this.fnMouseOver));}Tab.prototype = { fnMouseOver: function(ev) { var oEv = ev || event, oTarget = oEv.target || oEv.srcElement; oTarget.tagName.toUpperCase() === "LI" && (this.iNow = fgm.index(oTarget)); this.fnSwitch(); }, fnClick: function(ev) { var oEv = ev || event, oTarget = oEv.target || oEv.srcElement, i; switch(fgm.index(oTarget)) { case 0: if(oTarget.className == "prev") { this.aTab[this.iNow].style.display = "block"; this.iNow--; }; break; case 1: if(oTarget.className == "next") { for(i = 0; i < this.iNow; i++) this.aTab[i].style.display = "none"; this.iNow++; }; break; }; this.aTab[this.iNow].style.display = "block"; this.fnSwitch(); }, fnSwitch: function() { for(var i = 0; i < this.aTab.length; i++) (this.aTab[i].className = "", this.aItems[i].style.display = "none"); this.aTab[this.iNow].className = "current"; this.aItems[this.iNow].style.display = "block"; this.oPrev.className = this.iNow == 0 ? "prevNot" : "prev"; this.oNext.className = this.iNow == this.aTab.length - 1 ? "nextNot" : "next"; }};//应用fgm.on(window, "load", function() { var aItem = fgm.$$$("item"), i = 0; for(; i < aItem.length; i++) new Tab(aItem[i]);});

教育
基础教育 英语培训 左右

北京四中网校 学大教育 中国统一教育网 101远程教育网 巨人教育 黄冈中学网校新东方 英孚教育 环球雅思 韦博国际英语 华尔街英语 新航道

完整榜单

教育
基础教育 英语培训 左右

北京四中网校 学大教育 中国统一教育网 101远程教育网 巨人教育 黄冈中学网校新东方 英孚教育 环球雅思 韦博国际英语 华尔街英语 新航道

完整榜单

教育
基础教育 英语培训 左右

北京四中网校 学大教育 中国统一教育网 101远程教育网 巨人教育 黄冈中学网校新东方 英孚教育 环球雅思 韦博国际英语 华尔街英语 新航道

完整榜单

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。