This did the trick for me
$("#id").click(function(){
$("#id").off("mouseleave");
});
or $('#id').off('mouseleave mouseover');
,如果你想知道如何重新接通(我花了一段時間才能找出,其不只是像開關一樣,你必須重複你的代碼,所以因此我把我的鼠標懸停&鼠標離開事件中的函數)
$('#id').click(function() {
$('.class').on('mouseover', mouseoverEvents);
$('.class).on('mouseleave', mouseleaveEvents);
});
功能mouseoverEvents(){
var origImg = ($(this).find('.imageUrl'));
if (origImg.is('img')) {
Pixastic.process(origImg[0], 'blurfast', { amount: 1 });
}
$(this).find('.moreInfo, .addIcon').removeClass('displayNone');
$(this).find('.productText').height('100%');
$(this).find('.productText').stop().animate({ 'top': '-1.5vw' });
}
功能mouseleaveEvents(){
var origImg = ($(this).find('.imageUrl'));
Pixastic.revert($(this).find('.imageUrl')[0]);
$(this).find('.productText').stop().animate({ 'top': '0' });
$(this).find('.moreInfo, .addIcon').addClass('displayNone');
}
[你的解決方案的工作](http://jsfiddle.net/4vTCr/1/),但我在問我的問題時並不精確。我想刪除不透明度,並將「mousleleave」事件僅限於最後點擊的圖像。其他圖像應該有'mouseleave' /'mouseneter'事件,即使它們被點擊過。 – user1292810 2012-03-26 11:57:15
是這樣的:http://jsfiddle.net/4vTCr/2/? – 472084 2012-03-26 13:04:52
是的,現在完美。謝謝! – user1292810 2012-03-26 13:20:27