Coder Social home page Coder Social logo

Callback not always fired about swipe HOT 10 CLOSED

thebird avatar thebird commented on July 20, 2024
Callback not always fired

from swipe.

Comments (10)

thebird avatar thebird commented on July 20, 2024

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?

from swipe.

owain avatar owain commented on July 20, 2024

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!

from swipe.

bcolflesh avatar bcolflesh commented on July 20, 2024

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.

from swipe.

owain avatar owain commented on July 20, 2024

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.

from swipe.

bcolflesh avatar bcolflesh commented on July 20, 2024

Understood - thanks for the reply!

from swipe.

thebird avatar thebird commented on July 20, 2024

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.

from swipe.

owain avatar owain commented on July 20, 2024

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 transitionend listener on the element?

from swipe.

mech avatar mech commented on July 20, 2024

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?

from swipe.

thebird avatar thebird commented on July 20, 2024

Swipe2 will have a callback function (immediately after the swipe) and a transitionEnd function (after animation) :)

Feel free to start testing it out here

from swipe.

mech avatar mech commented on July 20, 2024

Thanks for this :)

from swipe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.