2010-12-03 74 views
0

我是新來的jquery,因爲在大約一個月的時間在......我在編碼,但我我仍然在將這個項目拼湊在一起時遇到問題。我試圖創建一個下拉菜單,當我把鼠標放在鏈接上隱藏顯示,然後我想能夠瀏覽到該div,當我嘗試把我的鼠標放入該div它關閉,不會停留打開是因爲我已將鼠標移出鏈接。我如何讓div可以瀏覽?Jquery:Dropdownmenu問題讓Div一直保持打開和鼠標懸停,它關閉之前,我甚至可以把我的鼠標進入它

鏈接到項目http://www.nestudiosonline.com/test.php

jQuery的;

// JavaScript Document 

$(document).ready(function() { 
    // shows the hidden div 
    $('#about').mouseover(function() { 
     $('#aboutdke').css('display','block'); 
     return false; 
    }); 
    // hides the hide the div again 
    $('#about').mouseleave(function() { 
     $('#aboutdke').css('display','none'); 
     return false; 
    }); 
}); 

我知道應該有更多的代碼,但我不能弄明白。 Thanksssss

+1

你有鼠標離開約上,將其更改爲你所顯示的時候大約鼠標懸停在div .... ///應該修復它, – kobe 2010-12-03 05:36:17

+0

@gov - 你應該將其作爲答案發布。 – karim79 2010-12-03 05:38:31

回答

1
$(document).ready(function() { 
    // shows the hidden div 
    $('#about').mouseover(function() { 
     $('#aboutdke').show(); 
     return false;// there is no need of return false here 
    }); 
    // hides the hide the div again 
    $('#changeit to the sub menu id').mouseleave(function() { 
     $('#aboutdke').hide(); 
     return false; // there is no need of return false here 
    }); 
}); 

用戶jQuery的懸停意圖的插件非常好的補充延遲也

http://cherne.net/brian/resources/jquery.hoverIntent.html