Home › Forums › JavaScript › anythingSlider – detect clone slide
- This topic is empty.
-
AuthorPosts
-
July 25, 2011 at 10:46 am #33626
Allen
ParticipantIs there a way to detect the slide to a cloned page? Thanks for any help in advance.
July 25, 2011 at 11:17 am #83923Allen
ParticipantWell, Detecting when the slider wraps on the loop would work too. Sorry, it’s early for me.
July 25, 2011 at 4:59 pm #83936Mottie
MemberHi 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();
}
}July 26, 2011 at 11:14 am #83988Allen
ParticipantHi 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.
July 29, 2013 at 1:38 pm #145067Historical Forums User
ParticipantI 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);
}
}
} -
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.