Forums

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

Home Forums JavaScript anythingSlider – detect clone slide

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #33626
    Allen
    Participant

    Is there a way to detect the slide to a cloned page? Thanks for any help in advance.

    #83923
    Allen
    Participant

    Well, Detecting when the slider wraps on the loop would work too. Sorry, it’s early for me.

    #83936
    Mottie
    Member

    Hi Allen!

    I’m not sure why you’d want this ability but you can do it by adding this to the initialization code; here is a demo:

        onSlideBegin: function(e, slider) {
    if (slider.exactPage === 0 || slider.exactPage === slider.pages + 1) {
    $('#display').fadeIn().delay(1000).fadeOut();
    }
    }
    #83988
    Allen
    Participant

    Hi Mottie!

    Perfect. Thank you. As for why I need the ability, I will actually be messaging you regarding it shortly I hope. Just trying to do as much as I can before I bring in the big guns in on my idea, lol.

    Thanks again.

    #145067

    I realize this is a old thread, but wanted to make a comment for anyone who maybe looking for the same solution.

    This solved my problem and makes me wonder why exactPage is not listed on the GitHub page.

    I have a ipad web app that uses anythingslider with touchwipe, and is built dynamically with xml based on user criteria. They did not want it to be one long slide set but 4 sections, each with its own set of navigation dots at the bottom. basically when you get to the end of one set of slides, when you swipe it jumps to the next set.

    Anyways, this worked great except when a sectionended up having 2 slides. then

    slider.currentPage == slider.pages && slider.targetPage == 1 and slider.currentPage == 1 && slider.targetPage == slider.pages

    didn’t work because the targetPage backward was the same as forward.

    The info from this thread lead me to use

    if (slider.currentPage == 2 && slider.targetPage == 1 && slider.targetPage != slider.exactPage)

    after checking if slider.pages < 2

    Hope this helps someone.

    Full if statement in “onSlideBegin”:
    if(slider.pages > 2){
    if (slider.currentPage == slider.pages && slider.targetPage == 1 && slider.targetPage != slider.exactPage){
    if (curSec < setArray.length – 1){
    curSec = curSec + 1;
    }else if (curSec == setArray.length – 1){
    curSec = 0;
    }
    slideBuilder(curSec,false);
    }else if (slider.currentPage == 1 && slider.targetPage == slider.pages && slider.targetPage != slider.exactPage){
    if (curSec >= 1){
    curSec = curSec – 1;
    slideBuilder(curSec,true);
    }else if (curSec == 0){
    curSec = setArray.length – 1;
    slideBuilder(curSec,true);
    }
    }
    }else{
    if (slider.currentPage == 2 && slider.targetPage == 1 && slider.targetPage != slider.exactPage){
    if (curSec < setArray.length – 1){
    curSec = curSec + 1;
    }else if (curSec == setArray.length – 1){
    curSec = 0;
    }
    slideBuilder(curSec,false);
    }else if (slider.currentPage == 1 && slider.targetPage == slider.pages && slider.targetPage != slider.exactPage){
    if (curSec >= 1){
    curSec = curSec – 1;
    slideBuilder(curSec,true);
    }else if (curSec == 0){
    curSec = setArray.length – 1;
    slideBuilder(curSec,true);
    }
    }
    }

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.