0
我試圖做一個延遲功能。當我點擊某個段落時,MENU被預置在本段中。但我需要隱藏MENU當mouseleave
或mouseout
延遲。如何在mouseout/mouseleave上延遲刪除div?
下面是一個例子:http://jsfiddle.net/ynternet/bZLAv/
HTML
<p class="add_to_this1">Click here 1</p>
<p class="add_to_this2">Click here 2</p>
<p class="add_to_this3">Click here 3</p>
<div id="menu"> I'm here</div>
jQuery的
jQuery.fn.handler = function() {
$(this).on({
click: function(e) {
if ($(this).find("#menu").length) {
return;
}
$('#menu').prependTo($(this));
$("#menu").css({
position: "absolute",
left: "100px"
}).show();
}
});
}
$(".add_to_this1").handler();
$(".add_to_this2").handler();
$(".add_to_this3").handler();
你試過什麼嗎?在當前的代碼中,這個問題沒有任何關係 – zerkms