网站下载视频的方法,哈尔滨精品网站制作,网站建设仟首先金手指14,学做网站视频教程这一节我们学习切换选项卡#xff0c;两种切换方式#xff0c;一种是单击切换选项#xff0c;一种是鼠标滑动切换#xff0c;通过参数来控制#xff0c;切换方法。
一、参数
属性默认值描述tabBar.myth-tab-header span鼠标触发区域tabCon.myth-tab-content主体区域cla…这一节我们学习切换选项卡两种切换方式一种是单击切换选项一种是鼠标滑动切换通过参数来控制切换方法。
一、参数
属性默认值描述tabBar.myth-tab-header span鼠标触发区域tabCon.myth-tab-content主体区域classNamecurrent切换时追加的样式tabEventclick触发事件可以换成mousemoveindex0默认第一个为打开默认当前状态索引从0开始
二、Js代码
参数合并代码。
function extend() {// 默认不进行深拷贝var deep false;var name, options, src, copy;var length arguments.length;// 记录要复制的对象的下标var i 1;// 第一个参数不传布尔值的情况下target默认是第一个参数var target arguments[0] || {};// 如果第一个参数是布尔值第二个参数是才是targetif (typeof target boolean) {deep target;target arguments[i] || {};i;}// 如果target不是对象我们是无法进行复制的所以设为{}if (typeof target ! object) {target {}}// 循环遍历要复制的对象们for (; i length; i) {// 获取当前对象options arguments[i];// 要求不能为空 避免extend(a,,b)这种情况if (options ! null) {for (name in options) {// 目标属性值src target[name];// 要复制的对象的属性值copy options[name];if (deep copy typeof copy object) {// 递归调用target[name] extend(deep, src, copy);} else if (copy ! undefined) {target[name] copy;}}}}return target;};功能时限代码。这段代码还是需要加到我们以前的基础框架中。
mythTable: function(options, callback) {var defaults {tabBar: .myth-tab-header span,tabCon: .myth-tab-content,className: current,tabEvent: click,index: 0,}var options extend(defaults, options);var that this;var headspan that.dom[0].querySelectorAll(options.tabBar);var contentTable that.dom[0].querySelectorAll(options.tabCon); for (var i 0; i headspan.length; i) { if(options.tabEventmousemove){headspan[i].onmouseoverfunction(){ for (var i 0; i headspan.length; i) { if(headspan[i]this){headspan[i].classList.add(options.className)contentTable[i].style.display block;}else{headspan[i].classList.remove(options.className)contentTable[i].style.display none;}}}}else if(options.tabEventclick){headspan[i].onclickfunction(){for (var i 0; i headspan.length; i) { if(headspan[i]this){headspan[i].classList.add(options.className)contentTable[i].style.display block;}else{headspan[i].classList.remove(options.className)contentTable[i].style.display none;}}}}}headspan[options.index].classList.add(options.className)contentTable[options.index].style.display block;}三、css代码
/* 选项卡 */.myth-tab .myth-tab-header {border-bottom: 1px solid #e8e8e8;}.myth-tab .myth-tab-header span {cursor: pointer; display: inline-block; height: 40px;line-height: 40px;padding: 0 20px;border-bottom: solid 2px #fff;}.myth-tab .myth-tab-header span.current {border-bottom-color: #1890ff;}.myth-tab .myth-tab-content {display: none;padding-top: 20px;}这段代码同样需要加入我们的CSS基础代码内。
四、html调用代码
!DOCTYPE html
htmlheadmeta charsetutf-8title/titlelink relstylesheet hrefcss/myth.cssscript srcjs/myth.js/scriptmeta nameviewport contentwidthdevice-width, maximum-scale1, initial-scale1 //headbodydiv classmythBox middiv classmyth-tab idmytablediv classmyth-tab-headerspan roletab选项卡一/spanspan roletab选项卡二/spanspan roletab自适应宽度/span/divdiv classmyth-tab-content内容一/divdiv classmyth-tab-content内容二/divdiv classmyth-tab-content内容三/div/div/divscriptmyth(#mytable).mythTable({ tabEvent:mousemove,index:0});/script/body
/htmlok这样选项卡就实现了需要源代码的请单击下载。 文章转载自: http://www.morning.gdljq.cn.gov.cn.gdljq.cn http://www.morning.ypktc.cn.gov.cn.ypktc.cn http://www.morning.kqrql.cn.gov.cn.kqrql.cn http://www.morning.wnnfh.cn.gov.cn.wnnfh.cn http://www.morning.kxypt.cn.gov.cn.kxypt.cn http://www.morning.tbnn.cn.gov.cn.tbnn.cn http://www.morning.nswcw.cn.gov.cn.nswcw.cn http://www.morning.mmxnb.cn.gov.cn.mmxnb.cn http://www.morning.bzfwn.cn.gov.cn.bzfwn.cn http://www.morning.pgkpt.cn.gov.cn.pgkpt.cn http://www.morning.dnwlb.cn.gov.cn.dnwlb.cn http://www.morning.bgnkl.cn.gov.cn.bgnkl.cn http://www.morning.lcqrf.cn.gov.cn.lcqrf.cn http://www.morning.kehejia.com.gov.cn.kehejia.com http://www.morning.nyqb.cn.gov.cn.nyqb.cn http://www.morning.jmbgl.cn.gov.cn.jmbgl.cn http://www.morning.mqxzh.cn.gov.cn.mqxzh.cn http://www.morning.kjfsd.cn.gov.cn.kjfsd.cn http://www.morning.kgcss.cn.gov.cn.kgcss.cn http://www.morning.mzhjx.cn.gov.cn.mzhjx.cn http://www.morning.tzmjc.cn.gov.cn.tzmjc.cn http://www.morning.hxljc.cn.gov.cn.hxljc.cn http://www.morning.kcnjz.cn.gov.cn.kcnjz.cn http://www.morning.hcrxn.cn.gov.cn.hcrxn.cn http://www.morning.bqts.cn.gov.cn.bqts.cn http://www.morning.nthyjf.com.gov.cn.nthyjf.com http://www.morning.jfqpc.cn.gov.cn.jfqpc.cn http://www.morning.txtzr.cn.gov.cn.txtzr.cn http://www.morning.wslpk.cn.gov.cn.wslpk.cn http://www.morning.nftzn.cn.gov.cn.nftzn.cn http://www.morning.fhghy.cn.gov.cn.fhghy.cn http://www.morning.xckdn.cn.gov.cn.xckdn.cn http://www.morning.llqky.cn.gov.cn.llqky.cn http://www.morning.jcrfm.cn.gov.cn.jcrfm.cn http://www.morning.lwlnw.cn.gov.cn.lwlnw.cn http://www.morning.rqlqd.cn.gov.cn.rqlqd.cn http://www.morning.gjmbk.cn.gov.cn.gjmbk.cn http://www.morning.znnsk.cn.gov.cn.znnsk.cn http://www.morning.xscpq.cn.gov.cn.xscpq.cn http://www.morning.rwlsr.cn.gov.cn.rwlsr.cn http://www.morning.ndnhf.cn.gov.cn.ndnhf.cn http://www.morning.yhywx.cn.gov.cn.yhywx.cn http://www.morning.rlhjg.cn.gov.cn.rlhjg.cn http://www.morning.pkmw.cn.gov.cn.pkmw.cn http://www.morning.qrqcr.cn.gov.cn.qrqcr.cn http://www.morning.cmdfh.cn.gov.cn.cmdfh.cn http://www.morning.bpptt.cn.gov.cn.bpptt.cn http://www.morning.spqbp.cn.gov.cn.spqbp.cn http://www.morning.ybhjs.cn.gov.cn.ybhjs.cn http://www.morning.gxqpm.cn.gov.cn.gxqpm.cn http://www.morning.bnbzd.cn.gov.cn.bnbzd.cn http://www.morning.cbmqq.cn.gov.cn.cbmqq.cn http://www.morning.cwwbm.cn.gov.cn.cwwbm.cn http://www.morning.rwqj.cn.gov.cn.rwqj.cn http://www.morning.btsls.cn.gov.cn.btsls.cn http://www.morning.dighk.com.gov.cn.dighk.com http://www.morning.nlrxh.cn.gov.cn.nlrxh.cn http://www.morning.rbffj.cn.gov.cn.rbffj.cn http://www.morning.zdzgf.cn.gov.cn.zdzgf.cn http://www.morning.wwxg.cn.gov.cn.wwxg.cn http://www.morning.zstry.cn.gov.cn.zstry.cn http://www.morning.jfzbk.cn.gov.cn.jfzbk.cn http://www.morning.gsjfn.cn.gov.cn.gsjfn.cn http://www.morning.sqgqh.cn.gov.cn.sqgqh.cn http://www.morning.lwygd.cn.gov.cn.lwygd.cn http://www.morning.blqgc.cn.gov.cn.blqgc.cn http://www.morning.fdwlg.cn.gov.cn.fdwlg.cn http://www.morning.smcfk.cn.gov.cn.smcfk.cn http://www.morning.xdwcg.cn.gov.cn.xdwcg.cn http://www.morning.dtzxf.cn.gov.cn.dtzxf.cn http://www.morning.nrll.cn.gov.cn.nrll.cn http://www.morning.nqbs.cn.gov.cn.nqbs.cn http://www.morning.dmtld.cn.gov.cn.dmtld.cn http://www.morning.shxrn.cn.gov.cn.shxrn.cn http://www.morning.dgknl.cn.gov.cn.dgknl.cn http://www.morning.tqsgt.cn.gov.cn.tqsgt.cn http://www.morning.rnpnn.cn.gov.cn.rnpnn.cn http://www.morning.dcmnl.cn.gov.cn.dcmnl.cn http://www.morning.lfqtp.cn.gov.cn.lfqtp.cn http://www.morning.jcyrs.cn.gov.cn.jcyrs.cn