SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jquery image help

    Hi I have two things I am trying to get jquery to do.

    1) I am currently using innerfade to run through a list of images, but when I get to the last image I want it to pause. I am not sure innerfade will do this and I couldn't find that function on the cycle plugin either - any ideas?

    2) I want an image to load and then fade out after say 3 seconds. Is this possible?

    I am open to any solution, not necessarily jquery based.

  2. #2
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok after much much digging, some trial and error, and some dumb luck I figured these two things out.

    For innerfade, it was relatively easy to add an extra clause to determine if you're at the end, as the script resets the 'current' variable to 0. From there, I manually added a timeout. Of course this will not work if you are using innerfade in multiple places and one of those places you DO NOT want extra timeout on the last image.

    if (current == 0) {
    setTimeout((function() {
    $.innerfade.next(elements, settings, current, last);
    }), 6000);
    }

    else {
    setTimeout((function() {
    $.innerfade.next(elements, settings, current, last);
    }), settings.timeout);
    }

    Then, the more obvious one, I simply called the following. I didn't want to do this entirely with a fade, but this worked well enough for fading out a region around 3 second after load.:

    $('#faderegion').fadeOut(3000,function(){
    });


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •