Giter VIP home page Giter VIP logo

Comments (4)

stephband avatar stephband commented on September 26, 2024

If you bind a move event to the body, the script assumes you want to move, not scroll, the body. To conditionally suppress scrolling, see the documentation here:

http://stephband.info/jquery.event.swipe/#scroll

from jquery.event.move.

AndersBillLinden avatar AndersBillLinden commented on September 26, 2024

What I really want is to check if the mouse is released anywhere in the document. (Still having the possibility to scroll the document). I only have a handler 'movestart' in a certain element, not in body.

from jquery.event.move.

stephband avatar stephband commented on September 26, 2024

Yes I see. You want to delegate moveend to handle all moveends for the document. But moveend cancels scroll because it assumes you're listening for a move, not a scroll. You should be able to set up a movestart also on the body, use it to enable scrolling (by calling .preventDefault() if event.target is not one of the things you want to move), and the moveend handler will still pick up delegates from the things you have moved.

It's a bit tricky getting jQuery special events to delegate nicely, and the move events weren't designed with this use case in mind. Should work, though.

from jquery.event.move.

AndersBillLinden avatar AndersBillLinden commented on September 26, 2024

I ended up checking target in the moveStart handler.

$('body').on('movestart', function(e)
{
  if ($(e.target).closest('.event-slider .scrolled-content').length == 0)
    e.preventDefault();
});

Thanks for the help!

from jquery.event.move.

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.