jQuery實現響應滑鼠滾動的動感菜單效果,jquery動感

來源:互聯網
上載者:User

jQuery實現響應滑鼠滾動的動感菜單效果,jquery動感

本文執行個體講述了jQuery實現響應滑鼠滾動的動感菜單效果。分享給大家供大家參考。具體如下:

這是響應滑鼠滾動的一款jQuery動感菜單,橫向豎向這個大家怎麼改吧,使用了jquery外掛程式,不要忘記載入哦。看效果的時候如果載入有錯誤,請重新整理一下頁面就行了。

運行效果如下:

線上示範地址如下:

http://demo.jb51.net/js/2015/jquery-mouse-over-dg-menu-style-codes/

具體代碼如下:

<!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><title>響應滑鼠滾動的jQuery動感菜單</title><style>ul#topnav {  margin: 15px 0 50px 0;  padding: 0;  list-style: none;  float: left;  font-size: 1.1em;}ul#topnav li {  margin: 0;  padding: 0;  overflow: hidden;  float: left;  height: 40px;}ul#topnav li.home {  width: 75px;}ul#topnav li.Rss {  width: 75px;}ul#topnav li.Portfolio {  width: 105px;}ul#topnav li.Blog {  width: 75px;}ul#topnav li.About {  width: 80px;}ul#topnav li.Contact {  width: 95px;}ul#topnav a, ul#topnav span {  padding: 10px 20px;  float: left;  text-decoration: none;  color: #fff;  background: url(images/a_bg.gif) repeat-x;  text-transform: uppercase;  clear: both;  width: 100%;  height: 20px;  line-height: 20px;}ul#topnav a{  color: #555;  background-position: left bottom;}ul#topnav span {   background-position: left top;}ul#topnav.v2 span {  background: transparent url(images/a_bg.gif) repeat-x left top;}ul#topnav.v2 a {  background: transparent url(images/a_bg.gif) repeat-x left bottom;  color: #555;}</style><script type="text/javascript" src="jquery1.3.2.js"></script></head><script>$(document).ready(function() {$("#topnav li").prepend("<span></span>");$("#topnav li").each(function() {var linkText = $(this).find("a").html();$(this).find("span").show().html(linkText);}); $("#topnav li").hover(function() {$(this).find("span").stop().animate({marginTop: "-40"}, 250);} , function() {$(this).find("span").stop().animate({marginTop: "0"}, 250);});});</script><body><ul id="topnav"> <li><a href="#">Home</a></li> <li><a href="#">Portfolio</a></li> <li><a href="#">Blog</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> <li><a href="#">Rss</a></li></ul></body></html>

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.