Eric
Eric

Reputation: 6445

JQuery-Mobile swipe doesn't work when you start on an anchor tag

I have swipeleft/swiperight working well in my app but when the user does the mousedown over an anchor tag, the swiping action is not triggered.

How can I make the swipe work even when the user does the mousedown on an anchor tag?

EDIT: It looks like this is only an issue in browsers on computers - tablets work fine.

Upvotes: 7

Views: 3206

Answers (3)

Trent
Trent

Reputation: 1381

You can swipe with the normal left button in any modern browser on the desktop.

Make sure you prevent the default action on the dragstart event on your div.

$("div").bind('dragstart', function(event) {event.preventDefault(); });

I have a working copy here...

http://jsfiddle.net/38nXe/

Upvotes: 8

Rantiev
Rantiev

Reputation: 2242

As for me it was caused "excludedElements", it filters all buttons, select, textarea, inputs and anchors.

To make it work add additional parameter with empty array for example.

$("#test").swipe({ excludedElements:[] });

See touchSwipe plugin docs here enter link description here

Upvotes: 0

Alex
Alex

Reputation: 2359

You can swipe on a desktop browser using the right mouse button. It is not very elegant as it also opens the context menu. But it works everywhere. Alex

Upvotes: 2

Related Questions