側(cè)邊欄導(dǎo)航標(biāo)簽:
專注于為中小企業(yè)提供網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)和田免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了上千企業(yè)的穩(wěn)健成長(zhǎng),幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
aside
nav
ul
li菜單一/li
li菜單二/li
li菜單三/li
li菜單四/li
li菜單五/li
/ul
/nav
/aside
樣式自己加。
這個(gè)可以通過絕對(duì)定位,配合left設(shè)置 或者translate去實(shí)現(xiàn)
left的方法:
比如讓class為menu的元素寬為300px,高100%的,設(shè)置left為-300px;在這期間可以加一個(gè)過渡transition:left 0.3s ...;
然后讓class為menu active的元素設(shè)置 left設(shè)置為0就可以了 ,在這期間可以加一個(gè)過渡transition:left 0.3s ...;
然后可以通過Jquery的toggleClass('active');來實(shí)現(xiàn)切換
translate
比如讓class為menu的元素寬為300px,高100%的,設(shè)置left為-300px;在這期間可以加一個(gè)過渡transition:left 0.3s ...;
然后讓class為menu active的元素設(shè)置 transform:translate3d(-300px,0,0) ,在這期間可以加一個(gè)過渡transition:left 0.3s ...;
然后可以通過Jquery的toggleClass('active');來實(shí)現(xiàn)切換
這個(gè)過程中 需要注意 body需要overflow:hidden; (不然會(huì)有滾動(dòng)條,可設(shè)置overflow-x即可)
left 和 translate 最好用translate ,translate3d可以開啟GPU硬件加速,性能會(huì)更好,體驗(yàn)會(huì)更流暢
我github有類似小組件樣式
github: IFmiss
希望能解決你的問題
這問題好糾結(jié),最少來個(gè)截圖啊,給你寫個(gè)吧,粘過去就行,不行的話留個(gè)q,繼續(xù)問
!DOCTYPE?html
html
head
meta?charset="utf-8"?/
title選項(xiàng)卡/title
style?type="text/css"
::-webkit-scrollbar{width:0px}
*{?margin:0;?padding:0}
ul{
list-style:?none;
}
.tab{?
width:?600px;
margin:?80px?auto;
}
.tab?.tab_menu{
float:left;
height:?138px;
width:?90px;?
overflow-y:scroll;
}
.tab?.tab_menu?ul{width:60px;}
.tab?.tab_menu?ul?li{
width:?60px;
text-align:?center;
line-height:?30px;
}
.tab?.tab_menu?ul?li:last-child{
border-right:none;
width:60px;
}
.tab?.tab_menu?ul?li.on{
background:?#999;
}
.tab_box{float:left;}
.tab?.tab_box??div{
width:?300px;
height:?138px;
border:1px?solid?#6cf;
display:?none;?//將三個(gè)內(nèi)容框架全隱藏,通過下面的:first-child屬性只將第一個(gè)框架內(nèi)容顯示出來
}
.tab?.tab_box??div:first-child{
display:?block;
}
/style
/head
body
!--整體構(gòu)局說明,用ul完成按鈕的橫向布局,用div完成三個(gè)內(nèi)容框架的垂直布局(類似于類表),然后將三個(gè)內(nèi)容框架全隱藏,通過下面的:first-child屬性只將第一個(gè)框架內(nèi)容顯示出來--
div?class="tab"
div?class="tab_menu"
ul
li?class="on"實(shí)事/li
li政治/li
li體育/li
li實(shí)事/li
li政治/li
li體育/li
li實(shí)事/li
li政治/li
li體育/li
li實(shí)事/li
li政治/li
li體育/li
/ul
/div
div?class="tab_box"
div實(shí)事內(nèi)容/div
div政治內(nèi)容/div
div體育內(nèi)容/div
div實(shí)事內(nèi)容/div
div政治內(nèi)容/div
div體育內(nèi)容/div
div實(shí)事內(nèi)容/div
div政治內(nèi)容/div
div體育內(nèi)容/div
div實(shí)事內(nèi)容/div
div政治內(nèi)容/div
div體育內(nèi)容/div
/div
/div
script?type="text/javascript"?src=""/script
script?type="text/javascript"
$(function(){
$(".tab_menu?ul?li").click(function(){
$(this).addClass("on").siblings().removeClass("on");?//切換選中的按鈕高亮狀態(tài)
var?index=$(this).index();?//獲取被按下按鈕的索引值,需要注意index是從0開始的
$(".tab_box??div").eq(index).show().siblings().hide();?//在按鈕選中時(shí)在下面顯示相應(yīng)的內(nèi)容,同時(shí)隱藏不需要的框架內(nèi)容
});
});
/script
/body
/html
一共有4種側(cè)滑動(dòng)畫特效。這款CSS3菜單的特點(diǎn)是鼠標(biāo)劃過時(shí)即可以各種動(dòng)畫方式展開和隱藏菜單項(xiàng),該動(dòng)畫方式由CSS3中的transition-delay屬性來完成
style type="text/css"
/*Fontawesome Iconfont*/
@import url();
@import url();
* {margin: 0; padding: 0;}
li {list-style-type: none;}
.grid {float: left;width:980px;margin: 0 auto;}
.grid li { width: 285px; height: 500px; overflow: hidden; float: left; margin: 20px 0 20px 30px; position: relative; }
.grid li:hover {box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.5);}
.gridli section {position: relative; transition: all 0.25s; width: 100%;}
.gridli h2 {font: bold 14px montserrat; color: #fff; text-transform: uppercase; position: absolute; text-align: center; width: 60%; left: 20%; top: 100px; padding: 10px 0; border: 2px solid white; border-radius: 4px;}
.sidenav { position: absolute; top: 0; left: 0; bottom: 0; background: linear-gradient(rgba(50,60,60, 1), rgba(50,60,60, 0.7)); width: 50px; transition: all 0.25s; overflow: hidden; padding-top: 100px;}
.sidenav li { _overflow: hidden; width: 150px; }
.sidenav a { text-decoration: none; color: #eee; display: block; line-height: 48px; }
.sidenav span {display: block;}
.sidenav b { padding-left 10px; display: block; color: white; font-family: Montserrat; font-size: 12px; line-height: 4; opacity: 0; }
.sidenav a i { display: block; float: left; font-size: 16px; line-height: 48px; width: 50px; text-align: center; }
/*All instances*/
.gridli:hover .sidenav {width: 150px;}
.gridli:hover section {margin-left: 150px;}
.gridli:hover b {opacity: 1;}
.sidenav li:nth-child(1) b, .sidenav li:nth-child(1) a {transition-delay: .08s;}
.sidenav li:nth-child(2) b, .sidenav li:nth-child(2) a {transition-delay: .16s;}
.sidenav li:nth-child(3) b, .sidenav li:nth-child(3) a {transition-delay: .24s;}
.sidenav li:nth-child(4) b, .sidenav li:nth-child(4) a {transition-delay: .32s;}
.sidenav li:nth-child(5) b, .sidenav li:nth-child(5) a {transition-delay: .40s;}
.sidenav li:nth-child(6) b, .sidenav li:nth-child(6) a {transition-delay: .48s;}
/*Three*/
.three .w {transform: perspective(100px) translateZ(-24px);}
.three b {transform: perspective(100px) rotateY(180deg) translateZ(24px) scale(0.5); }
.three:hover b {transform: perspective(100px) rotateY(0) translateZ(24px) scale(1); transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275); background: transparent;}
.three .sidenav {width: 150px;}
/*Two*/
.two .w {transform: perspective(100px) translateZ(-24px);}
.two b {transform: perspective(100px) rotateX(90deg) translateZ(24px) scale(1.5); opacity: 0; }
.two:hover b {transform: perspective(100px) rotateX(0) translateZ(24px) scale(1); transition: all .4s; opacity: 1;}
.two .sidenav {width: 150px;}
/*One*/
.one .w {transform: perspective(100px);}
.one b {transform: perspective(100px) rotateY(90deg); _opacity: 0; transform-origin: left center; _border: 1px solid white;}
.one:hover b {transform: perspective(100px) rotateX(0); transition: all .4s; opacity: 1;}
.one .sidenav {width: 150px;}
.one .sidenav span {float: left; width: 100px;}
/style
!--[if IE]
script src=""/script
![endif]--
/head
body
div class="htmleaf-container"
header class="htmleaf-header bgcolor-11"
div class="htmleaf-demo center"
a href="index.html"DEMO1/a
a href="index2.html" class="current"DEMO2/a
a href="index3.html"DEMO3/a
a href="index4.html"DEMO4/a
/div
div style="text-align:center;clear:both;"
script src="/gg_bd_ad_720x90.js" type="text/javascript"/script
script src="/follow.js" type="text/javascript"/script
/div
/header
div class="htmleaf-content bgcolor-8"
ul class="grid"
li class="one"
ul class="sidenav"
liai class="fa fa-check"/ispan class="w"bTasks/b/span/a/li
liai class="fa fa-inbox"/ispan class="w"bMessages/b/span/a/li
liai class="fa fa-pencil"/ispan class="w"bNew Post/b/span/a/li
liai class="fa fa-cog"/ispan class="w"bSettings/b/span/a/li
liai class="fa fa-star"/ispan class="w"bStarred/b/span/a/li
liai class="fa fa-power-off"/ispan class="w"bLogout/b/span/a/li
/ul
section
h2Door Opening/h2
img src="img/mb1.png"/
/section
/li
li class="two"
ul class="sidenav"
liai class="fa fa-check"/ispan class="w"bTasks/b/span/a/li
liai class="fa fa-inbox"/ispan class="w"bMessages/b/span/a/li
liai class="fa fa-pencil"/ispan class="w"bNew Post/b/span/a/li
liai class="fa fa-cog"/ispan class="w"bSettings/b/span/a/li
liai class="fa fa-star"/ispan class="w"bStarred/b/span/a/li
liai class="fa fa-power-off"/ispan class="w"bLogout/b/span/a/li
/ul
section
h2Flip Down/h2
img src="img/mb2.png"/
/section
/li
li class="three"
ul class="sidenav"
liai class="fa fa-check"/ispan class="w"bTasks/b/span/a/li
liai class="fa fa-inbox"/ispan class="w"bMessages/b/span/a/li
liai class="fa fa-pencil"/ispan class="w"bNew Post/b/span/a/li
liai class="fa fa-cog"/ispan class="w"bSettings/b/span/a/li
liai class="fa fa-star"/ispan class="w"bStarred/b/span/a/li
liai class="fa fa-power-off"/ispan class="w"bLogout/b/span/a/li
/ul