亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

漂亮的jQuery左邊劃出導(dǎo)航

Original 2019-03-17 16:29:07 275
abstract:index.html: <!DOCTYPE html> <html lang="en"> <head> <title>jQuery左邊滑出導(dǎo)航</title> <link rel="stylesheet" href="static/css/st
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<title>jQuery左邊滑出導(dǎo)航</title>
<link rel="stylesheet" href="static/css/style.css">
<link rel="stylesheet" href="static/font-awesome/css/font-awesome.min.css">
<script src="static/js/jquery.js"></script>
</head>
<body>
<ul id="nav">
<li class="li1"><span class="fa fa-tags"></span></li>
<li class="li2"><span class="fa fa-address-card"></span></li>
<li class="li3"><span class="fa fa-grav"></span></li>
<li class="li4"><span class="fa fa-user-o"></span></li>
<li class="li5"><span class="fa fa-handshake-o"></span></li>

</ul>

<script>

$(function(){
$('#nav li').stop().animate({'marginLeft':'-65px'},1000)
$('li').hover(function(){
$(this).stop().animate({'marginLeft':'-2px'},500)
},
function(){
$(this).stop().animate({'marginLeft':'-65px'},500)
}
)
})

</script>
</body>
</html>

style.css:
*{
margin: 0px;
padding: 0px;
}
ul{
list-style: none;
position: fixed;
top: 10px;
left: 0px;
}
#nav li{
width: 80px;
height: 80px;
margin: 10px 0px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
line-height: 80px;
text-align: center;
}
.li1{
background: rgba(77, 31, 216, 0.5)
}
.li2{
background: rgba(247, 3, 8, 0.5)
}
.li3{
background: rgba(247, 247, 3, 0.5)
}
.li4{
background: rgba(44, 3, 247, 0.5)
}
.li5{
background: rgba(3, 247, 36, 0.5)
}
#nav li span{
font-weight: 700;
font-size: 30px;
color: #fff;
}

jQuery animate() 方法用于創(chuàng)建自定義動(dòng)畫。

語(yǔ)法:

$(selector).animate({params},speed,callback);

 params :必需的

 speed :可選的

 callback :可選的


jQuery stop() 方法用于停止動(dòng)畫或效果,在它們完成之前。

stop() 方法適用于所有 jQuery 效果函數(shù),包括滑動(dòng)、淡入淡出和自定義動(dòng)畫。


hover()方法用于模擬光標(biāo)懸停事件。

當(dāng)鼠標(biāo)移動(dòng)到元素上時(shí),會(huì)觸發(fā)指定的第一個(gè)函數(shù)(mouseenter);當(dāng)鼠標(biāo)移出這個(gè)元素時(shí),會(huì)觸發(fā)指定的第二個(gè)函數(shù)(mouseleave)。


Correcting teacher:查無(wú)此人Correction time:2019-03-18 09:09:44
Teacher's summary:完成的不錯(cuò),js每行語(yǔ)句后面增加;號(hào)。養(yǎng)成好習(xí)慣。繼續(xù)加油

Release Notes

Popular Entries