-
// 封裝id函數(shù) function $(id) { return typeof id === 'string' ? document.getElementById(id) : id; } //加載 window.onload = function() { var titles = $("notice-title").getElementsByTagName("li"); var divs = $("notice-content").getElementsByTagName("div"); if(titles.length != divs.length) return; var id = 0; for(var i = 0; i < titles.length; i++) { titles[i].id = i; titles[i].onmouseover = function() { for(var j = 0; j < titles.length; j++) { titles[j].className = ""; divs[j].style.display = "none"; } this.className = "select"; divs[this.id].style.display = "block"; } } }查看全部
-
1、 最左和最右的標(biāo)題項(xiàng)被選擇時(shí),邊框和外邊框靠近會使邊框變?yōu)?倍寬度,通過將標(biāo)題欄設(shè)置得比外div元素寬,絕對定位使標(biāo)題欄left:-1px,令內(nèi)邊框和外邊框重合,從而只顯示1倍邊框?qū)挾取?2.、下邊框處理:將下邊框顏色設(shè)為白色即可。 3.、左右邊框處理:在定義標(biāo)題項(xiàng)寬度時(shí)通過padding留出左右邊框的位置,在被選擇時(shí)設(shè)置左右邊框后清除掉padding即可,從而不會使文本內(nèi)容發(fā)生變化。 .notice{ width: 298px; height: 98px; border: 1px solid #eee; margin: 10px; overflow: hidden; } .notice-title{ height: 27px; position: relative; background: #F7F7F7; } .notice-title ul{ position: absolute; width: 301px; left: -1px; } .notice-title li{ float: left; width: 58px; height: 26px; line-height: 26px; text-align: center; overflow: hidden; padding:0 1px; background: #fff; border-bottom: 1px; background: #F7F7F7; } .notice-title li.select{ padding: 0; background: #FFFFFF; border-bottom: #FFFFFF; border-left: 1px solid #EEEEEE; border-right: 1px solid #EEEEEE; }查看全部
-
Uncaught TypeError: ps[i].addEventListener is not a function at window.onload查看全部
-
a:hover .content{dispaly: block;}查看全部
-
dispaly: none;查看全部
-
flaot overflow: hidden查看全部
-
:nth-of-type(n):hover + div.content {tarnsform: translateX()} ??? no JS, just CSS!查看全部
-
span ::before ::after查看全部
-
background data-select="selected"查看全部
-
boz-sizing: border-box; :hover查看全部
-
tabs column contents column查看全部
-
inder查看全部
-
setInterval()的使用方法 setInterval()的特點(diǎn): setInterval()方法會不停地調(diào)用函數(shù),直到clearInterval()被調(diào)用或窗口被關(guān)閉 由setInterval()返回的ID值可用作clearInterval()方法的參數(shù)查看全部
-
clearTimeout(定時(shí)器,一般為setTimeout所在的變量) setTimeout()和setInterval()的區(qū)別: setTimeout()方法是超時(shí)調(diào)用,也就是在什么時(shí)間以后干什么查看全部
-
選項(xiàng)卡切換類型: 滑過切換 點(diǎn)擊切換 延遲切換 自動切換查看全部
舉報(bào)
0/150
提交
取消