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

本次課程作業(yè)的總結(jié)合和理解

original 2018-10-07 16:02:44 264
abstrait:<!DOCTYPE html><html><head> <title></title> <script type="text/javascript" src="jquery-3.3.1.min.js"></script><style type="text/cs

<!DOCTYPE html>

<html>

<head>

<title></title>

<script type="text/javascript" src="jquery-3.3.1.min.js"></script>


<style type="text/css">

*{padding: 0px;margin: 0px;}

ul {list-style: none;z-index: 20;position: relative;font-size: 15px;}

li {float: left;cursor: pointer;width: 100px; height: 30px;text-align: center;line-height: 30px;color: #fff;font-weight: bold;}

.menu {width: 500px;position: relative;margin: 20px auto;height: 32px; box-shadow: 0 2px 20px #000; background: #AF3434;border-radius: 3px;}


</style>


<script type="text/javascript">


$(function(){

$('li').hover(

function(){

$x = parseInt($(this).attr('name'))*100

$('.block').stop().animate({left: $x + 'px'}, 300)


},

function(){

$('.block').stop().animate({left:'0px'},300)

}

)

})

</script>



</head>


<body>



<div class="menu">

<ul>

<li name="0">首頁</li>

<li name="1">php中文網(wǎng)</li>

<li name="2">獨(dú)孤九劍</li>

<li name="3">西門大官人</li>

<li name="4">滅絕師太</li>

</ul>

<div class="block" style="z-index: 10;width: 100px;height: 2px; background: #fff;position: absolute;top: 30px"></div>

</div>


</body>

</html>

<!-- 

name設(shè)定的數(shù)字隱含了位置移動(dòng)的距離,通過parseInt()進(jìn)行采集并同步放大100在加上px單位,即可通過hover實(shí)現(xiàn)下劃線的移動(dòng)

stop()的作用在于一個(gè)緩沖,因?yàn)橛袃蓚€(gè)動(dòng)作,一個(gè)是移動(dòng),另外一個(gè)是還原。那么stop()起到了緩沖的作用,是的效果不會(huì)沖突

還原的過程就是把初始位移重新設(shè)定為0 -->


Notes de version

Entrées populaires