2013-01-24 35 views
0

我正在一個網站的項目列表是100%不透明,一旦項目徘徊,所有其他項目減少到30%不透明度。我工作正常使用下面的代碼。現在我需要的是點擊的項目保持100%的不透明度,並從其他項目中消除淡入淡出。誰能幫忙?由於jquery徘徊其他列表項目上懸停,然後保持項目在100%不透明度點擊

$(function() { 
$("#input_1_8>li").hover( 
function() {}, 
function() {  
$('#input_1_8>li').fadeTo(0.1, 1.0); 
}); 

$("#input_1_8>li").hoverIntent(
function(){ 
$(this).attr('class', 'current'); // Add class .current 
$(this).siblings().fadeTo(0.1, 0.3); // Fade other items to 30% 
$(this).fadeTo(0.1, 1.0); // Fade current to 100% 
}, 
function(){    
$(this).removeClass("current"); // Remove class .current 
$(this).fadeTo(0.1, 1.0); // This should set the other's opacity back to 100% on mouseout 
} 
); 
$("#input_1_8>li").on('click', function(){ 
$("#input_1_8>li").unbind("mouseenter"). 
       unbind("mouseleave"); 
}); 


}); 

回答

0

嘗試:如果

$("#sites>li").on('click', function(){ 
    $("#sites>li").unbind("mouseenter"). 
        unbind("mouseleave"); 
}); 
+0

不知道我把這個在正確的位置。它被點擊時將所有列表項目重置爲100%不透明度。 –

+0

這不是你想要的嗎? 「被點擊的項目保持100%不透明度並消除其他項目的淡入淡出」 – AlienWebguy

+0

不,我很抱歉,我沒有說出正確的答案。我希望物品保持100%,其他物品保持褪色至30%。所以懸停不會影響他們了。 –