Richard
Richard

Reputation: 1474

Specifying the opacity on fadeToggle

Is there a way to use fadeToggle() but specify the opacity it goes down to, instead of having the element disappear?

Here's what I have so far:

$("#toc li").on("mouseenter mouseleave", function(){
        $("#toc li").not(this).stop().fadeToggle();
});

Upvotes: 2

Views: 903

Answers (1)

Roko C. Buljan
Roko C. Buljan

Reputation: 206268

$("#toc li").hover(function( e ){
    $(this).siblings('li').stop().fadeTo(400, e.type=='mouseenter' ? 0.4 : 1);
});

or invert the logic 1 : 0.4 depends on what you need.

Upvotes: 4

Related Questions