Grow your CSS skills. Land your dream job.

Click function Slideshow help?

  • # August 10, 2012 at 11:09 am

    Hey guys,
    I’m new to web programming (so bear with me!) and am trying to build this slideshow and have got the interval working to switch the slides, but I now need to connect the thumbnails when clicked to go to the proper pic. I have an idea of what to do, but can’t figure out the proper syntax to write to make it happen? : / Help?!

    Here is the jQuery code:

    function slideSwitch() {
    var $active = $(‘#slideshow IMG.active’);

    if ( $active.length == 0 ) $active = $(‘#slideshow IMG:last’);

    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}, 1000, function() {
    $active.removeClass(‘active last-active’);
    });
    }

    /*WHAT DO I DO HERE?!!!
    $(‘#menu ul li a’).click( “slideSwitch()”);
    */

    $(function() {
    setInterval( “slideSwitch()”, 4000 );
    });

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".