Grow your CSS skills. Land your dream job.

Anything Slider startstoppend if one slide only?

  • # November 16, 2009 at 4:22 am

    Hey Guys

    As I write in the subject how can I make the "Anything Slider" have startstopped set to true if there is only one slide in the slider!
    I have tried to test for length but it don’t seem to work.

    Here’s what I tried.

    Code:
    var slideLength = $j(‘#top-image-wrap ul’).find(‘> li’).length;

    if ( slideLength >= 3 ) {

    $j(‘#top-image’).anythingSlider({
    easing: “easeInOutExpo”,
    autoPlay: true,
    startStopped: true,
    delay: 5000,

    navigationFormatter: null
    });

    } else {

    $j(‘#top-image’).anythingSlider({
    easing: “easeInOutExpo”,
    autoPlay: true,
    startStopped: false,
    delay: 5000,

    navigationFormatter: null
    });

    }

    When I type

    Code:
    $j(‘#top-image-wrap ul’).find(‘> li’).length;

    in consul in firebug it returns 3. And that make sence since there is one original and 2 clones.

    I always mix up the > < but I have tried the different combinations and noting seems to work. I’m sure it’s a really simple problem but I just cant make it work.

    Hope you can help.

    Mads

    # November 16, 2009 at 4:40 am

    Solved it:

    The length test don’t include the clones so the >= 3 should be a != 1 and then it works.

    Mads

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

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