Longpress / longclick event support / plugin in jQuery

后端 未结 3 1025
离开以前
离开以前 2021-02-09 01:40

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

3条回答
  •  被撕碎了的回忆
    2021-02-09 02:24

    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.");
    });
    
    
        
    

    Click me!

    You didn't click yet.

提交回复
热议问题