国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jQuery實現菜單感應鼠標滑動動畫效果的方法

2019-11-20 13:04:36
字體:
來源:轉載
供稿:網友

本文實例講述了jQuery實現菜單感應鼠標滑動動畫效果的方法。分享給大家供大家參考。具體分析如下:

此代碼測試環境為IE9 以及GG、FF瀏覽器,IE8及以下瀏覽器可能不支持,希望理解。

這款JS鼠標滑動效果使用jQuery實現簡單動畫的方法,而且也驚喜的發現,jquery有更好的書寫方法,可以連寫,在animate方法前加上stop方法就可實現鼠標移出后,不再執行滑動效果。

復制代碼 代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>非常不錯的jQuery鼠標滑動效果</title>
<script src="js/jquery.min.js" type="text/javascript"></script>
<style>
body{font-size:12px;font-family:Tahoma,Arial,Verdana;color:#fff; background:#000; width:100%; height:100%;}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td ,i{padding:0;margin:0}
fieldset,img {border:0}
.clear{ clear:both;}
address,caption,cite,code,dfn,em,th,var {font-weight:normal;font-style:normal}
ol,ul {list-style:none}
caption,th {text-align:left}
h1,h2,h3,h4,h5,h6 {font-size:100%}
abbr,acronym,img {border:0}
button,input,select,textarea{font-size:100%;}
input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;}
table {border-collapse:collapse;border-spacing:0;}
a{text-decoration:none;}
a:hover {text-decoration:underline;}
.clearfix:after {visibility: hidden;display: block;font-size: 0;content: ".";clear:both;}
.all ul{ width:100%; text-align:center;}
.all ul li{ width:100%; height:40px; line-height:40px; border-bottom:1px dashed #990066; cursor:pointer;}
</style>
</head>
<body>
<div class="all">
<ul>
<li>第一項</li>
<li>第二項</li>
<li>第三項</li>
</ul>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('.all ul li').mouseover(function(){
$(this).animate({"height":"70px","line-height":"70px"},100)
}).mouseleave(function(){
$(this).stop().animate({"height":"40px","line-height":"40px"},100)
});
})
</script>
</body>
</html>

希望本文所述對大家的jQuery程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 讷河市| 新竹县| 盈江县| 勃利县| 白城市| 宁河县| 绥阳县| 漠河县| 宁强县| 龙岩市| 阿瓦提县| 宁河县| 霍林郭勒市| 丰镇市| 武邑县| 芒康县| 寿光市| 闻喜县| 普兰县| 东辽县| 固原市| 青冈县| 普宁市| 府谷县| 霍城县| 西盟| 大同市| 科技| 额济纳旗| 五常市| 乌兰县| 玉溪市| 宜宾市| 南城县| 英吉沙县| 勃利县| 乌审旗| 汤阴县| 宜昌市| 格尔木市| 龙州县|