jQuery實現(xiàn)菜單感應(yīng)鼠標(biāo)滑動動畫效果的方法
本文實例講述了jQuery實現(xiàn)菜單感應(yīng)鼠標(biāo)滑動動畫效果的方法。分享給大家供大家參考。具體分析如下:
此代碼測試環(huán)境為IE9 以及GG、FF瀏覽器,IE8及以下瀏覽器可能不支持,希望理解。
這款JS鼠標(biāo)滑動效果使用jQuery實現(xiàn)簡單動畫的方法,而且也驚喜的發(fā)現(xiàn),jquery有更好的書寫方法,可以連寫,在animate方法前加上stop方法就可實現(xiàn)鼠標(biāo)移出后,不再執(zhí)行滑動效果。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>非常不錯的jQuery鼠標(biāo)滑動效果</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程序設(shè)計有所幫助。
相關(guān)文章
jQuery實現(xiàn)鼠標(biāo)選文字發(fā)新浪微博的方法
這篇文章主要介紹了jQuery實現(xiàn)鼠標(biāo)選文字發(fā)新浪微博的方法,涉及jQuery鼠標(biāo)事件的響應(yīng)及新浪接口的調(diào)用技巧,非常簡單實用的功能,需要的朋友可以參考下2016-04-04jquery實現(xiàn)的讓超出顯示范圍外的導(dǎo)航自動固定屏幕最頂上
經(jīng)常會遇到這樣的情況,當(dāng)頁面展示內(nèi)容過長時,想點導(dǎo)航切換欄目,就得把滾動條拉回到頂上,這樣操作總不太人性化,能不能讓導(dǎo)航超出顯示范圍外時自動貼在屏幕最頂上呢?答案肯定是能的。如果不太明白,把滾動條拉到下面點,看下我博客是效果就明白了。2011-09-09jQuery操作iframe中js函數(shù)的方法小結(jié)
這篇文章主要介紹了jQuery操作iframe中js函數(shù)的方法,結(jié)合實例形式總結(jié)分析了jQuery操作iframe中的元素、函數(shù)常用方法與注意事項,具有一定參考借鑒價值,需要的朋友可以參考下2016-07-07用Jquery.load載入頁面后樣式?jīng)]了頁面混亂的解決方法
一直想用jquery.load的方法載入新的頁面,以實現(xiàn)局部刷新,結(jié)果發(fā)現(xiàn)樣式?jīng)]了,后來發(fā)現(xiàn)了解決方法,如果不過濾掉一些內(nèi)容的話,直接加載,會使頁面混亂的2014-10-10使用jQuery ajaxupload插件實現(xiàn)無刷新上傳文件
項目中會經(jīng)常用到AJAX無刷新上傳圖片,但是iframe上傳和flash插件都是比較復(fù)雜的,所以就找了一個jquery的插件。下面通過實例代碼給大家介紹使用jQuery ajaxupload插件實現(xiàn)無刷新上傳文件功能,需要的朋友參考下吧2017-04-04