小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

優(yōu)美網(wǎng)站首頁(yè),頂部多層導(dǎo)航

 丹楓無(wú)跡 2021-09-27

 

一個(gè)個(gè)人用的瀏覽器首頁(yè),可以把一下常用的網(wǎng)站放在這里,平常打開(kāi)會(huì)比較方便。

 第一步,HTML代碼


<script src="js/jquery-3.4.1.min.js"></script>
<div id="navigate">
<ul>
<li class="labels labels_1">
<p id="labels_1" >搜索</p>
<div class="tab one">
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
</div>
</li>
<li class="labels labels_2">
<p id="labels_2" >工作</p>
<div class="tab two">
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
</div>
</li>
<li class="labels labels_3">
<p id="labels_3" >學(xué)習(xí)</p>
<div class="tab three">
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
</div>
</li>
<li class="labels labels_4">
<p id="labels_4" >娛樂(lè)</p>
<div class="tab four">
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
<p><a href="#" target="_blank">名字</a></p>
</div>
</li>

</ul>
</div>

 

第二步,為HTML設(shè)置樣式

 


*{
margin: 0;
padding: 0;
list-style: none;
text-decoration: none;
color: white;
text-align: center;
}
body{
min-height: 100vh;
/*背景圖片路徑*/
background: url(https://raw./szharf/hello-world/master/images/%E4%B9%A6%E6%88%BF.jpg) no-repeat;
background-size:100% 100%;
font-family: "微軟雅黑";
}
#navigate{
width: 80%;
height: 50px;
margin: auto;
background-color: rgba(205,104,57,0.8) ;
}
.labels{
border-bottom:solid gainsboro 1px;
float: left;
width: 25%;
line-height: 50px;
font-size: 20px;
}
.tab{
display: none;
background-color:rgba(238,118,33,0.8);
overflow:auto;
appearance:none;
-moz-appearance:none;
-webkit-appearance:none;
font-size: 16px;
line-height: 40px;
}
/*美化滾動(dòng)條*/
.tab::-webkit-scrollbar-track {
-webkit-box-shadow:inset 0 0 3px rgba(238,118,33,0.3);
background-color:#F5F5F5;
}
.tab::-webkit-scrollbar {
width:5px;
background-color:#font: 5px F5 F5;;
}
.tab::-webkit-scrollbar-thumb {
background-color:#CD6839;
border:2px solid #CD6839;
}

第三步,用jQuery添加事件

 

$(function(){
//鼠標(biāo)懸浮顯示div的內(nèi)容
$(".labels_1").mouseover(function () {
$(".one").slideDown();
//鼠標(biāo)離開(kāi),div隱藏
}).mouseleave(function () {
$(".one").slideUp();
})
//2
$(".labels_2").mouseover(function () {
$(".two").slideDown();
}).mouseleave(function () {
$(".two").slideUp();
})
//3
$(".labels_3").mouseover(function () {
$(".three").slideDown();
}).mouseleave(function () {
$(".three").slideUp();
})
//4
$(".labels_4").mouseover(function () {
$(".four").slideDown();
}).mouseleave(function () {
$(".four").slideUp();
})

//獲取頁(yè)面高度,減去頂部高度
var height =$(window).height()-51;
//獲取內(nèi)容的高度
var height1 =$('.one').outerHeight();
//判斷div高度是否大于頁(yè)面高度
if(height1>=height){
//當(dāng)div高度大于頁(yè)面高度時(shí),為div設(shè)置高度
$(".one").height(height);
}
var height2 =$('.two').outerHeight();
if(height2>=height){
$(".two").height(height);
}
var height3 =$('.three').outerHeight();
if(height3>=height){
$(".three").height(height);
}
var height4 =$('.four').outerHeight();
if(height4>=height){
$(".four").height(height);
}
})

好了,很簡(jiǎn)單,這就已經(jīng)完成了

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約