Skip to content
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

Long Press option not working on mobile devices #356

Open
prasannavalleti opened this issue Dec 14, 2016 · 5 comments
Open

Long Press option not working on mobile devices #356

prasannavalleti opened this issue Dec 14, 2016 · 5 comments

Comments

@prasannavalleti
Copy link

No description provided.

@vTrip
Copy link

vTrip commented Jan 11, 2017

@a5hik any updates on this ?

@princexebia
Copy link

I am also facing same issue. On long press of Item my screen is getting reloaded :-(

@mikey0000
Copy link

longTouch attribute never gets applied.

@mikey0000
Copy link

@iwanmcm
Copy link

iwanmcm commented Apr 14, 2020

It didn't work for me, although the longTouch option was set to true.

I changed the bindDrag function in the ng-sortable.js file to bind longTouchStart and longTouchCancel to the 'touchstart' and 'touchend' events. Now the drag & drop also works on mobile for me.

Before change:

bindDrag = function () {
            if (hasTouch) {
              if (isLongTouch) {
                if (isIOS) {
                  element.bind('touchstart', longTouchStart);
                  element.bind('touchend', longTouchCancel);
                  element.bind('touchmove', longTouchCancel);
                } else {
                  element.bind('contextmenu', dragListen);
                }
              } else {
                element.bind('touchstart', dragListen);
              }
            }
            element.bind('mousedown', dragListen);
          };

After change:

bindDrag = function () {
              element.bind('touchstart', longTouchStart);
              element.bind('touchend', longTouchCancel);
              element.bind('touchmove', longTouchCancel);
              element.bind('contextmenu', dragListen);
              element.bind('touchstart', dragListen);
            element.bind('mousedown', dragListen);
          };

So it seems that some of touch events were bound only on iOS devices. Binding them on every device has solved the problem for me. Maybe there were changes in the events that the browsers produce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants