I'm working on a website which requires mouseover menu's. I would not recommend mouseover menu's from an accessibility point of view, but it's pretty easy to implement using jQuery.
The problem: we also need to support touchscreen devices (tablets). On such a device you don't have a mouse and, so the mouseover event is not working. I was hoping for jQuery to have a longpress event, but it doesn't. I did find a jQuery longclick plugin using Google, but it was for jQuery 1.4, so I'm not keen on using that. Also the jQuery plugin site is under maintenance at the moment, so that is not very helpful.
So the question: is there an elegant plugin for jQuery 1.7 / 1.8 to support longpress / longclick events?
It turns out that you can just use the existing longclick plugin for jQuery 1.4 with jQuery 1.8.
$("#area").mousedown(function(){
$("#result").html("Waiting for it...");
});
$("#area").longclick(500, function(){
$("#result").html("You longclicked. Nice!");
});
$("#area").click(function(){
$("#result").html("You clicked. Bummer.");
});
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script src="http://rawgit.com/pisi/Longclick/master/jquery.longclick-min.js"></script>
<p id="area">Click me!</p>
<p id="result">You didn't click yet.</p>