You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've read the docs, but there's still no sense in the results I'm seeing.
In onSlideBegin() it looks as if currentPage is 1-based and targetPage is 0-based. I am not using the cloned panel feature.
If I am on slide # 3 (= index 2), say, and I click to go back, then I expect currentPage=2 and targetPage=1. But I get currentPage=3 and targetPage=1. Similarly for other use cases.
the currentPage will include the cloned pages and doesn't get updated until the onSlideComplete() function. The targetPage will be the page where the slider will end up, it is updated for the onSlideBegin() function. If you are not seeing this behavior, then maybe there is a problem.
I am using infiniteSlides:false, so I "should not" have any cloned pages. Also I am using "external" controls, but I assume that whould not make a difference as the slider scrolls as expected, it's only that those properties are inconsistent.
The detail in your answer is exactly what I am expecting as normal behavior, but I get what I described above. I am assuming I am doing something wrong because this plugin is at a mature state. Are there any other gotchas I should know of in that event?
You said that currentPage includes the count of the cloned pages. If infiniteSlides is off, then I assume that currentPage takes that into account? If it doesn't, then that would explain the above results (unless I'm doing something wrong-more probable! :) ).
Okay works better now, but there may still be an issue.
When the plugin first loads, I trap the onInitialized() event, and I observe that currentPage==1. Should it not be 0?
Take a look at that demo you made, click away from the zeroth slide, then come back to it, and you'll see that currentPage==1. That seems to be because it starts off at 1 rather than 0.
It's working for me... make sure you refresh your browser cache.
Edit: Oh I see what you are saying... but the currentPage is a 1-based index of the panels, not zero based. So it should never be zero.
Actually, from your initial question, both currentPage and targetPage are 1-based. The only way to determine if the slider is going to show a cloned page is by looking at exactPage (undocumented)
Edit 2: Ugh, ok exactPage is off now LOL... here's an updated demo - it shouldn't be a big deal, but it might effect the FX extension.
I'm not fully understanding this. Please bear with me!
I will assume both are 1-based as you said, and that there are no cloned panels.
So, using your newest demo as a reference:
in onInitialized(), you're on slide 1, so currentPage==1 and targetPage==undefined --good
click on slide 2
in onSlideInit()/onSlideBegin() you'd expect currentPage==1 and targetPage==2, BUT currentPage==1 and targetPage==1
then in onSlideComplete() you'd expect currentPage==2 and targetPage==2, BUT currentPage==2 and targetPage==1
click on slide 1 to go back to the beginning
in onSlideInit()/onSlideBegin() you'd expect currentPage==2 and targetPage==1, BUT currentPage==2 and targetPage==0
then in onSlideComplete() you'd expect currentPage==1 and targetPage==1, BUT currentPage==1 and targetPage==0
It seems as if currentPage is 1-based, and targetPage is 0-based.
PS: be careful when you inspect that demo in jsfiddle, every time I move away from that tab (I'm in Firefox BTW), it automatically runs the script for some reason, and gives more results, which initially threw me off.
PS: another thing that is worrying me, is that infiniteSlides is off, and yet the slider nonetheless wraps. The green coloring makes it hard to see, so check it in Firebug and you'll see the activePage class gets added to the first/last li. I feel that these problems are probably related somehow.
Sorry I wish I could help dig into the codebase and help, but its big and I don't know where to start! :(
Are you really really sure you cleared your browser cache? Click on the "Manage Resources" header, then click on "jquery.anythingslider.js" and see what version you see. If it isn't 1.7.20, then hold down your Shift key and click on the browser reload button. Then run the demo. Because this is a screen shot of what I'm seeing after following the same steps you describe above (demo used).
As for the second problem, the demo has infiniteSlides set to false (not off) and from viewing the slider in Firebug, I see the activePage class applied appropriately. I even set the infiniteSlides option back to true and it's fine.
WOW, that was weird. You're right it was the browser. I obviously cleared the cache but it didn't work, and I didn't realise it was using the old version. After struggling for a while, I loaded the script into a new tab, cleared the cache, reloaded the script, which showed 1.7.20. Then when I reloaded jsfiddle, it picked up the new version. Weird!
As for the wrapping, yes, in my code I used stopAtEnd: true so I was surprise by the demo's results. All's well now.
Sorry to bring this up again, but I want to verify there isn't a regression bug in the latest version. This time I cleared the cache and verified the version of the plugin! :)
This time I'm not checking the slider.targetPage index, but rather the index of the slider.$targetPageobject, and it appears to be incorrect. Please have a look at the demo and see if you get the same results?
Activity
Mottie commentedon Dec 16, 2011
Hi samf3!
the
currentPagewill include the cloned pages and doesn't get updated until theonSlideComplete()function. ThetargetPagewill be the page where the slider will end up, it is updated for theonSlideBegin()function. If you are not seeing this behavior, then maybe there is a problem.samf3 commentedon Dec 16, 2011
Hi Mottie, and thanks for a truly awesome plugin.
I am using
infiniteSlides:false, so I "should not" have any cloned pages. Also I am using "external" controls, but I assume that whould not make a difference as the slider scrolls as expected, it's only that those properties are inconsistent.The detail in your answer is exactly what I am expecting as normal behavior, but I get what I described above. I am assuming I am doing something wrong because this plugin is at a mature state. Are there any other gotchas I should know of in that event?
Are they both 0-based or 1-based?
samf3 commentedon Dec 16, 2011
You said that
currentPageincludes the count of the cloned pages. IfinfiniteSlidesis off, then I assume thatcurrentPagetakes that into account? If it doesn't, then that would explain the above results (unless I'm doing something wrong-more probable! :) ).Mottie commentedon Dec 16, 2011
Nope, you're right, it is a bug... demo
I'll patch it up :)
samf3 commentedon Dec 16, 2011
Wow I thought I was going mad :) Thanks.
Mottie commentedon Dec 17, 2011
Ok, this has been fixed in version 1.7.20. Thanks for reporting it!
samf3 commentedon Dec 17, 2011
Okay works better now, but there may still be an issue.
When the plugin first loads, I trap the
onInitialized()event, and I observe thatcurrentPage==1. Should it not be0?Take a look at that demo you made, click away from the zeroth slide, then come back to it, and you'll see that
currentPage==1. That seems to be because it starts off at1rather than0.Mottie commentedon Dec 17, 2011
It's working for me... make sure you refresh your browser cache.
Edit: Oh I see what you are saying... but the currentPage is a 1-based index of the panels, not zero based. So it should never be zero.
Actually, from your initial question, both
currentPageandtargetPageare 1-based. The only way to determine if the slider is going to show a cloned page is by looking atexactPage(undocumented)Edit 2: Ugh, ok exactPage is off now LOL... here's an updated demo - it shouldn't be a big deal, but it might effect the FX extension.
samf3 commentedon Dec 17, 2011
I'm not fully understanding this. Please bear with me!
I will assume both are 1-based as you said, and that there are no cloned panels.
So, using your newest demo as a reference:
onInitialized(), you're on slide 1, socurrentPage==1andtargetPage==undefined--goodin
onSlideInit()/onSlideBegin()you'd expectcurrentPage==1andtargetPage==2, BUTcurrentPage==1andtargetPage==1then in
onSlideComplete()you'd expectcurrentPage==2andtargetPage==2, BUTcurrentPage==2andtargetPage==1in
onSlideInit()/onSlideBegin()you'd expectcurrentPage==2andtargetPage==1, BUTcurrentPage==2andtargetPage==0then in
onSlideComplete()you'd expectcurrentPage==1andtargetPage==1, BUTcurrentPage==1andtargetPage==0It seems as if
currentPageis 1-based, andtargetPageis 0-based.PS: be careful when you inspect that demo in jsfiddle, every time I move away from that tab (I'm in Firefox BTW), it automatically runs the script for some reason, and gives more results, which initially threw me off.
PS: another thing that is worrying me, is that
infiniteSlidesis off, and yet the slider nonetheless wraps. The green coloring makes it hard to see, so check it in Firebug and you'll see theactivePageclass gets added to the first/last li. I feel that these problems are probably related somehow.Sorry I wish I could help dig into the codebase and help, but its big and I don't know where to start! :(
Mottie commentedon Dec 17, 2011
Are you really really sure you cleared your browser cache? Click on the "Manage Resources" header, then click on "jquery.anythingslider.js" and see what version you see. If it isn't 1.7.20, then hold down your Shift key and click on the browser reload button. Then run the demo. Because this is a screen shot of what I'm seeing after following the same steps you describe above (demo used).
As for the second problem, the demo has
infiniteSlidesset tofalse(not off) and from viewing the slider in Firebug, I see theactivePageclass applied appropriately. I even set theinfiniteSlidesoption back to true and it's fine.samf3 commentedon Dec 17, 2011
WOW, that was weird. You're right it was the browser. I obviously cleared the cache but it didn't work, and I didn't realise it was using the old version. After struggling for a while, I loaded the script into a new tab, cleared the cache, reloaded the script, which showed 1.7.20. Then when I reloaded jsfiddle, it picked up the new version. Weird!
As for the wrapping, yes, in my code I used
stopAtEnd: trueso I was surprise by the demo's results. All's well now.Thanks for fixing this!
samf3 commentedon Dec 29, 2011
Sorry to bring this up again, but I want to verify there isn't a regression bug in the latest version. This time I cleared the cache and verified the version of the plugin! :)
I modified your demo, check here: http://jsfiddle.net/36MDS/10/
This time I'm not checking the
slider.targetPageindex, but rather the index of theslider.$targetPageobject, and it appears to be incorrect. Please have a look at the demo and see if you get the same results?Mottie commentedon Dec 29, 2011
DOH, ok fixed again. Thanks for finding it.
samf3 commentedon Dec 30, 2011
works!