Taphold 事件无法在 ScrollView 内部绑定
我正在使用 PhoneGap 和 Jquery-mobile 开发 iPhone 应用程序。 我的问题是我无法在scrollView 中绑定事件taphold。
我的应用程序具有如下结构:
HEADER:
<script src="javascripts/jquery.mobile/jquery.mobile-1.0.1.js"></script>
<script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script>
<script type="text/javascript" charset="utf-8" src="javascripts/jquery.easing.1.3.js"></script>
<script type="text/javascript" charset="utf-8" src="javascripts/jquery.mobile.scrollview.js"></script>
<script type="text/javascript" charset="utf-8" src="javascripts/scrollview.js"></script>
BODY:
<div data-role="content" data-theme= "d" data-scroll= "true" style= "overflow: scroll;">
<ul data-role="listview" data-theme="b">
<li data-icon="thumb-up"><a href="#" class="list-item">
<img src="http://jquerymobile.com/test/docs/lists/images/album-ok.jpg"
class = "ui-li-icon-small"></img>
<div class="user_note">
<p class="title-item">Broken Bells</p>
<p class="detail-item">Broken Bells</p>
<p class="time-past">5 minutes ago</p>
</div>
<p class="desc-item">this is descrition example test data this is descrition example test data </p>
</a>
</li>
...
</ul>
</div>
JAVASCRIPT:
$(".grid-item, .list-item").unbind('taphold');
$(".grid-item, .list-item").bind("taphold",
function(event, ui){
var icons = $(this).parent().parent().find(".ui-icon-thumb-up");
icons.load("thumb_x_icons.html");
});
如果我删除 ScrollView,该事件对我有用。
也许scrollView 阻止了一些事件。
有什么解决办法吗?或者你有什么办法监听 longPress 事件吗?
I'm using PhoneGap and Jquery-mobile to develop for iPhone app.
My problem is I can't bind event taphold inside scrollView.
My app have struct like below:
HEADER:
<script src="javascripts/jquery.mobile/jquery.mobile-1.0.1.js"></script>
<script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script>
<script type="text/javascript" charset="utf-8" src="javascripts/jquery.easing.1.3.js"></script>
<script type="text/javascript" charset="utf-8" src="javascripts/jquery.mobile.scrollview.js"></script>
<script type="text/javascript" charset="utf-8" src="javascripts/scrollview.js"></script>
BODY:
<div data-role="content" data-theme= "d" data-scroll= "true" style= "overflow: scroll;">
<ul data-role="listview" data-theme="b">
<li data-icon="thumb-up"><a href="#" class="list-item">
<img src="http://jquerymobile.com/test/docs/lists/images/album-ok.jpg"
class = "ui-li-icon-small"></img>
<div class="user_note">
<p class="title-item">Broken Bells</p>
<p class="detail-item">Broken Bells</p>
<p class="time-past">5 minutes ago</p>
</div>
<p class="desc-item">this is descrition example test data this is descrition example test data </p>
</a>
</li>
...
</ul>
</div>
JAVASCRIPT:
$(".grid-item, .list-item").unbind('taphold');
$(".grid-item, .list-item").bind("taphold",
function(event, ui){
var icons = $(this).parent().parent().find(".ui-icon-thumb-up");
icons.load("thumb_x_icons.html");
});
If I remove the ScrollView the event work for me.
Maybe the scrollView Prevent some events.
Is there any solution for this? or do you have any way to listening longPress event?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论