jQuery在悬停时淡化其他列表项,然后在单击时将项目保持在100%不透明度



我正在一个项目列表为 100% 不透明度的网站上工作,一旦将项目悬停,所有其他项目就会降低到 30% 的不透明度。我使用下面的代码正常工作。现在我需要的是让单击的项目保持 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");
});

});

尝试:

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

最新更新