如何在按钮上“长按”?

时间:2016-03-02 15:35:34

标签: javascript jquery html5

我写了这段代码:

<html>
<head>
<title>Long Press</title>
</head>
<body>
<div id="refresh_page">
<button>long press to refresh</button>
</div>
</body>
</html>

我希望用鼠标来long press on button刷新页面。但不使用javascript。

任何人都可以帮助我吗?

2 个答案:

答案 0 :(得分:2)

如果你真的不想使用javascript - 你可以长时间点击Flash!

动作脚本3:

private function mouseup(e:MouseEvent):void {
    stage.removeEventListener(MouseEvent.MOUSE_UP, mouseup);
    myTimer.reset();
}
private function showInfo(event:TimerEvent):void{
    //long press code
}
private function mousedown(event:MouseEvent):void{
    myTimer.start();
}

不可能的问题=已回答

答案 1 :(得分:1)

您可以在mousedownmouseup事件之间实现此计数时间。

这似乎是一个重复的问题:How to apply long click event and doubleclick event on the same element in javascript

<强> JS FIDDLE HERE

相关问题