Note that there are some explanatory texts on larger screens.

plurals
  1. PO"fadeTo" seems to have a bug when I scroll through images too fast
    primarykey
    data
    text
    <p>I am slowly learning how to modify and write jQuery from scratch and have been trying to modify some pre-written code, which simply makes an image opacity: 1 and all other images in the same HTML element opacity: 0.2.</p> <p>When I use fadeTo and I move across the images fast it will stop doing the animation and hang for a while until it fixes itself. Could anyone advise on this situation.</p> <p>Sorry for being a bit vauge :)</p> <p>Here is the code:</p> <pre><code>$(window).load(function(){ var spotlight = { // the opacity of the "transparent" images - change it if you like opacity : 0.2, /*the vars bellow are for width and height of the images so we can make the &lt;li&gt; same size */ imgWidth : $('#portfolio ul li').find('img').width(), imgHeight : $('#portfolio ul li').find('img').height() }; //set the width and height of the list items same as the images $('#portfolio ul li').css({ 'width' : spotlight.imgWidth, 'height' : spotlight.imgHeight }); //when mouse over the list item... $('#portfolio ul li').hover(function(){ //...find the image inside of it and add active class to it and change opacity to 1 (no transparency) $(this).find('img').addClass('active').fadeTo('fast', 1); //get the other list items and change the opacity of the images inside it to the one we have set in the spotlight array $(this).siblings('li').find('img').fadeTo('fast', 0.2); //when mouse leave... }, function(){ //... find the image inside of the list item we just left and remove the active class $(this).find('img').removeClass('active'); }); //when mouse leaves the unordered list... $('#portfolio ul').bind('mouseleave',function(){ //find the images and change the opacity to 1 (fully visible) $(this).find('img').fadeTo('fast', 1); }); </code></pre> <p>});</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.
    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