Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Anything Slider startstoppend if one slide only?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26778
    madebymads
    Member

    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

    #66636
    madebymads
    Member

    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)
  • The forum ‘JavaScript’ is closed to new topics and replies.