我有一個jQuery腳本,其中如果您使用mouseenter和元素,則會顯示某些內容,並且在您使用鼠標時會消失。我試圖在用戶點擊時解除綁定,以便在用戶離開時「顯示」一直顯示。這是做到這一點的正確方法嗎?如果是這樣,有人可以幫助我得到這個腳本的工作?單擊時不能解除鼠標離開
謝謝!
$('.block').live("mouseenter",function(){
var id= $(this).attr('id');
$('#arrowPreview'+id).show();
}).live("mouseleave",function(){
var id= $(this).attr('id');
$('#arrowPreview'+id).hide();
}).live("click",function(){
var id= $(this).attr('id');
$('#arrowPreview'+id).show();
$(this).unbind("mouseleave");
});
謝謝!
必須用'模具()'取消綁定活的事件處理程序 – amcc