DIV CSS 佈局教程網

jQuery 菜單滑鼠懸停伸縮動畫教學
編輯:JQuery特效代碼     

這個效果常用於側邊選單或導覽列:滑鼠移入時,項目高度增加;移出後恢復原狀。使用 jQuery 時,只要在 animate() 前加上 stop(),就能避免連續滑動造成動畫堆疊。

$('.all ul li').hover(function () { $(this).stop().animate({ height: '70px', lineHeight: '70px' }, 100); }, function () { $(this).stop().animate({ height: '40px', lineHeight: '40px' }, 100); });

若要相容舊版瀏覽器,可改用 mouseover() 與 mouseleave(),但核心概念相同:先停止目前動畫,再啟動新的高度變化。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved