0

I have been looking for a Zepto plugin for a longClick event. Zepto supports longTap which is great for mobile, but I want to switch in a longClick event when my page is visited on a desktop. I would also require that 'longClick' interferes with 'click' only allowing one or the other.

Any resources or ideas?

Make me work:

$(element).on('longClick', function() { console.log('longClick') });
Tyler Buchea
  • 1,642
  • 3
  • 17
  • 25
  • 1
    I would advise against it, desktop users aren't familiar with the long-click. It isn't intuitive. There are several touch-interface paradigms that have not yet been adopted on non-touch devices, the long-press is one of them. – TheZ Nov 07 '12 at 08:15
  • You may consider a right click for desktop users. That maps closest with the user's expectations. – Brian Nickel Nov 07 '12 at 15:54
  • I've thought about this too. Again I would really like to be able to .bind or .on the event instead of writing the logic in one event handling function. I'm not necessarily asking for a hand out. I can write the rightClick function myself, but how do I implement it as a Zepto event plugin? – Tyler Buchea Nov 08 '12 at 06:46

2 Answers2

0

try to use hammer.js its a great lib with a lot of events

or use this: https://github.com/quentint/long-press

tomerz
  • 199
  • 2
  • 10
0

I wanted the "longClick" event so I could test out my PhoneGap application on my desktop instead of having to run it on my phone every time which is very time consuming.

The solution I ended up using was to go into Chrome Developer Tools and "enable touch events". Not only did I no longer need a "longClick" event, but I was able to remove the extra code that would change my "tap" events to "click" on the destkop.

Tyler Buchea
  • 1,642
  • 3
  • 17
  • 25