如何在下拉菜單中設置時間或延遲5秒鐘。如何在下拉菜單中設置5秒的時間或延遲?
要求如下:當某人將鼠標懸停在主菜單上時,僅當鼠標遠離主菜單或子菜單時,才顯示子菜單5秒。
現在我已經增加了高達標高圖像的高度,以便它不會被隱藏,直到您將鼠標移出該標題區域。
下面是該網站的鏈接:http://transitions.advisorproducts.com/home
,這是一個參考站點鏈接:http://focusyou.com/home(我的要求是這樣的,但我不希望複製該代碼,我想在我自己的代碼來實現)
以下是JS:
$(function()
{
$("ul.dropdown li").hover(function()
{
$(this).addClass("hover");
$('ul:first',this).css('visibility', 'visible');
}, function()
{
$(this).removeClass("hover");
$('ul:first',this).css('visibility', 'hidden');
});
$("ul.dropdown li ul li:has(ul)").find("a:first").append(" » ");
});
感謝提前:)
您可以測試在這裏:http://jsfiddle.net/alokjain_lucky/KQAYT/2/
你知道['setTimeout'(https://developer.mozilla.org/en/DOM/window.setTimeout)? – 2012-07-16 07:38:19
你知道setTimeout(); – mfadel 2012-07-16 07:38:40