三款jquery 導覽功能表(利用jquery導航外掛程式)

來源:互聯網
上載者:User

添加了檔案 js/menu.js
所有只提供了jquery 導覽功能表代碼,css 等就不寫了。

*/
//滑鼠划過顯示菜單, 離開隱藏菜單
jquery(document).ready(function(){
 // 找到所有菜單, 並添加顯示和隱藏菜單事件
 jquery('#menus > li').each(function(){
  jquery(this).hover(
 
   // 顯示菜單
   function(){
    jquery(this).find('ul:eq(0)').show();
   },
 
   // 隱藏菜單
   function(){
    jquery(this).find('ul:eq(0)').hide();
   }
 
  );
 });
});

//滾動導覽功能表

//滑鼠移至上方顯示滾動展開菜單, 離開滾動捲起菜單. 需要加上延遲處理, 原因同淡出淡入導覽功能表的處理
var mouseo教程ver_tid = [];
var mouseout_tid = [];
 
jquery(document).ready(function(){
 jquery('#menus > li').each(function(index){
  jquery(this).hover(
 
   // 取消捲起菜單的線程, 延時展開菜單
   function(){
    var _self = this;
    cleartimeout(mouseout_tid[index]);
    mouseover_tid[index] = settimeout(function() {
     jquery(_self).find('ul:eq(0)').slidedown(200);
    }, 400);
   },
 
   // 取消展開菜單的線程, 延時捲起菜單
   function(){
    var _self = this;
    cleartimeout(mouseover_tid[index]);
    mouseout_tid[index] = settimeout(function() {
     jquery(_self).find('ul:eq(0)').slideup(200);
    }, 400);
   }
 
  );
 });
});


// 淡出淡入導覽功能表
var mouseover_tid = [];
var mouseout_tid = [];
 
jquery(document).ready(function(){
 jquery('#menus > li').each(function(index){
  jquery(this).hover(
 
   // 取消淡出菜單的線程, 延時淡入菜單
   function(){
    var _self = this;
    cleartimeout(mouseout_tid[index]);
    mouseover_tid[index] = settimeout(function() {
     jquery(_self).find('ul:eq(0)').fadein(200);
    }, 400);
   },
 
   // 取消淡入菜單的線程, 延時淡出菜單
   function(){
    var _self = this;
    cleartimeout(mouseover_tid[index]);
    mouseout_tid[index] = settimeout(function() {
     jquery(_self).find('ul:eq(0)').fadeout(200);
    }, 400);
   }
 
  );
 });
});

//


</script>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.