Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should add animation code to fadeout the active image so the transition is smoother. If you run all animations simultaneously you will have to tweak the timings to keep things smooth; I'm not sure why that is, but that's why I changed the duration to 2000 milliseconds.</p> <p>I tested the code below and it seems to work smoothly like this. I do however want to advise you to refactor you code so that you have only 1 animation function left. You should also resize the images you use for the slideshow (5 megabytes for an image is SERIOUS overkill).</p> <pre><code>function slideSwitch() { var $active = $('#slideshow IMG.active'); if ( $active.length == 0 ) $active = $('#slideshow IMG:last'); // use this to pull the images in the order they appear in the markup var $next = $active.next().length ? $active.next(): $('#slideshow IMG:first'); $active.addClass('last-active'); $next.css({opacity: 0.0}) .addClass('active') .animate({opacity: 1.0}, 2000, function() { $active.removeClass('active last-active'); }); $active.animate({opacity: 0}, 2000); } </code></pre> <p>If you really only want to hide the image after the show animation is complete, you can use the code below, but that really doesn't look very smooth to me, your choice of course. </p> <pre><code>function slideSwitch() { var $active = $('#slideshow IMG.active'); if ( $active.length == 0 ) $active = $('#slideshow IMG:last'); // use this to pull the images in the order they appear in the markup var $next = $active.next().length ? $active.next(): $('#slideshow IMG:first'); $active.addClass('last-active'); $next.css({opacity: 0.0}) .addClass('active') .animate({opacity: 1.0}, 2000, function() { $active.removeClass('active last-active'); $active.css({opacity: 0.0}); }); } </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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