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

首頁 > 語言 > JavaScript > 正文

鼠標懸浮顯示二級菜單效果的jquery實現

2024-05-06 16:10:09
字體:
來源:轉載
供稿:網友

當鼠標懸浮時顯示二級菜單,這種類似的效果,想必大家在瀏覽網頁時經常會遇到吧,下面有個示例,大家可以看看

1.布局:

  1. <div class="show">  
  2. <img src="~/images/head_icon.png" />  
  3.  
  4. <div class="drop" style=" display:none; z-index:80000" id="profileMenu">  
  5. <ul>  
  6. <li>  
  7. <a class="pass" style="cursor: pointer" 
  8. href='#'>  
  9. <span>修改密碼</span>  
  10. </a>  
  11. </li>  
  12. <li>  
  13. <a class="quit" style="cursor: pointer" 
  14. href='#' 
  15. ><span>退出</span></a>  
  16. </li>  
  17. </ul>  
  18. </div>  
  19. </div> 

2.js控制:
 

  1. function dropMenu(obj) {  
  2. $(obj).each(function () {  
  3. var theSpan = $(this);  
  4. var theMenu = theSpan.find(".drop");  
  5. var tarHeight = theMenu.height();  
  6. theMenu.css({ height: 0, opacity: 0 });  
  7.  
  8.  
  9. var t1;  
  10.  
  11.  
  12. function expand() {  
  13. clearTimeout(t1);  
  14. //theSpan.find('a').addClass("selected");  
  15. theMenu.stop().show().animate({ height: tarHeight, opacity: 1 }, 200);  
  16. }  
  17.  
  18.  
  19. function collapse() {  
  20. clearTimeout(t1);  
  21. t1 = setTimeout(function () {  
  22. // theSpan.find('a').removeClass("selected");  
  23. theMenu.stop().animate({ height: 0, opacity: 0 }, 200, function () {  
  24. $(this).css({ display: "none" });  
  25. });  
  26. }, 250);  
  27. }  
  28.  
  29.  
  30. theSpan.hover(expand, collapse);  
  31. theMenu.hover(expand, collapse);  
  32. });  
  33. }  
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 丰镇市| 丽江市| 邮箱| 白水县| 章丘市| 全州县| 丰台区| 布拖县| 中超| 罗源县| 炉霍县| 洞口县| 玉溪市| 隆回县| 外汇| 凤凰县| 无极县| 松潘县| 丰台区| 锦州市| 女性| 东安县| 五指山市| 屯留县| 建水县| 义乌市| 洞口县| 三亚市| 庆云县| 正阳县| 华安县| 玛多县| 赤水市| 丹巴县| 张家港市| 通许县| 蓝山县| 通许县| 讷河市| 海城市| 河曲县|