Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery fading/dimming other list elements when one is hovered over, I'm 90% there..?
    primarykey
    data
    text
    <p>I have an unordered list, which has maybe 30 items. When one of these items are hovered over, the rest of the list items fade to 30% and the hovered item stays at 100%; when you move away from the list, they all fade back up to 100% and I have managed this.</p> <p>My problems arises when you move from item to item, the other list items fade back up to 100% and then back down to 30%. I want them to stay at 30% unless the user moves away from the whole list.</p> <p>I use the hoverIntent plugin on each list item. I also used jQuery to add a class to the current list item, so I could then fade the rest and remove it once you move away. I have used a wait function found on the jQuery Cookbook site (<a href="http://docs.jquery.com/Cookbook/wait" rel="nofollow noreferrer">http://docs.jquery.com/Cookbook/wait</a>)</p> <p>Do you get me?</p> <p>Here's my code so far:</p> <pre><code>$.fn.wait = function(time, type) { time = time || 300; type = type || "fx"; return this.queue(type, function() { var self = this; setTimeout(function() { $(self).dequeue(); }, time); }); }; $("#sites li:not(#sites li li)").hoverIntent(function(){ $(this).attr('class', 'current'); // Add class .current $("#sites li:not(#sites li.current,#sites li li)").fadeTo("slow", 0.3); // Fade other items to 30% },function(){ $("#sites li:not(#sites li.current,#sites li li)").wait().fadeTo(600, 1.0); // This should set the other's opacity back to 100% on mouseout $(this).removeClass("current"); // Remove class .current }); </code></pre> <p>*Obviously this is within a $(document).ready(function()</p> <p>Can anyone help me please? </p> <p>Many thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload