【发布时间】:2012-03-24 12:41:30
【问题描述】:
电话间隙或 jquery 中是否有一个功能,这意味着我可以获取元素上的任何点击并按住事件。我查看了 phonegap 文档,但找不到任何东西
我看到 jQuery mobile 有它,但我目前没有包含它,我希望我不需要为此添加另一个库
谢谢
【问题讨论】:
标签: javascript jquery android cordova
电话间隙或 jquery 中是否有一个功能,这意味着我可以获取元素上的任何点击并按住事件。我查看了 phonegap 文档,但找不到任何东西
我看到 jQuery mobile 有它,但我目前没有包含它,我希望我不需要为此添加另一个库
谢谢
【问题讨论】:
标签: javascript jquery android cordova
在这里你可以做同样的事情。我已经在我的项目中尝试过
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script>
$(document).on("pagecreate","#pageone",function(){
$("p").on("taphold",function(){
$(this).hide();
});
});
</script>
</head>
<body>
<div data-role="page" id="pageone">
<div data-role="header">
<h1>The taphold Event</h1>
</div>
<div data-role="main" class="ui-content">
<p>If you tap and hold me for one second, I will disappear.</p>
<p>Tap and hold me!</p>
<p>Tap and hold me too!</p>
</div>
<div data-role="footer">
<h1>Footer Text</h1>
</div>
</div>
</body>
</html>
http://www.w3schools.com/jquerymobile/tryit.asp?filename=tryjqmob_event_taphold
【讨论】: