-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Callback not always fired #9
Comments
Yea the transition end function doesn't fire if you begin transitioning again before its complete, which makes sense I guess. A possible solution could be to provide another callback that fires on change of slide? Do you have a specific use case that needs a change of slide callback every time? |
Yeah that would work. I'm using swipe to make a paged result set. So basically I load a dataset and render a subset e.g 10 pages worth of data, render 3 pages of data and as the user swipes to the next page I pre-render the next page ready for when they swipe. So I need to know every time there is a slide. I currently calculate if it is a forward or back slide too, might be nice to have this as part of the callback params or something? Saying that, the simplicity of the script is it's strength so I wouldn't want to clog it up with unneeded functionality. Nice work btw! |
owilliams, is the paged result set logic you mentioned above available as public code anywhere? I need something similar and haven't found a good example using Swipe. |
I'm afraid it's not, it's part of a commercial product. It has some other dependancies on other libraries too (mainly backbone) and isn't very standalone at the moment. I may be able to make it available at some point, but not any time soon I'm afraid. If you want any pointers then fire me a message. |
Understood - thanks for the reply! |
Fellas, What if I make a second callback in the library, like pre-animation? It would fire when any movement has been determined to be a valid swipe to a next, prev slide. Let me know your thoughts. |
Yeah that should work. I guess you'd need to rename the callback options to be more descriptive too. It could be argued though that transition end callback isn't needed if you're able to add your own |
Yea, I also using this swipe to get paginated pay-slip kind of HR app. For example, on initial children I have 12 months of payslips for year 2011, then when the guy swipe to almost the end like in Feb 2011, I will want to remote load the previous years additional 12 months of payslips for year 2010. Right now the children detection is not "live" if I am not wrong. Is there a way to make use of delegation a.k.a the jQuery's live way of detecting children? |
Swipe2 will have a callback function (immediately after the swipe) and a transitionEnd function (after animation) :) Feel free to start testing it out here |
Thanks for this :) |
If you swipe very quickly several times it seems like the transition end event doesn't get fired (assuming because the actual transition doesn't fire?). This can be seen in the example below (mobile safari doesn't seem to like jsfiddle), everytime the callback is called we prepend to the list with the index. Press on the next link slowly and you see all callbacks, press quickly and you see we miss some indexes:
http://jsfiddle.net/4a2yy/3/
A hacky workaround is to call the callback at the end of the swipe function. I did this in the demo below, calling it within a setTimeout as otherwise it effects how smooth the transition appears in mobile safari.
http://jsfiddle.net/VecTR/9/
The text was updated successfully, but these errors were encountered: