jQuery Mobile:滚动视图和滑动事件 [英] jQuery Mobile: scrollview and swipe events

查看:110
本文介绍了jQuery Mobile:滚动视图和滑动事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基本的JQM页面,在滑动时会显示一个左侧的滑动菜单(例如facebook移动应用程序).在开始使用scrollview之前,它一直工作良好(正确地固定了标题).当我在页面内容上滑动时,不会触发该滑动事件(如果我在页眉上滑动,该事件仍然有效).

I have a basic JQM page which displays a left side sliding menu when swiping (like the facebook mobile app). It worked fine until I started using scrollview (to properly keep the header fixed). The swipe event is not triggered when I swipe over my page content (it still works if I swipe on the header).

$('.ui-page-active').live("swiperight", function() {
    if (!menuStatus) {  
        showMenu();
    }
}); 

有人对如何使其工作有任何想法吗?

Does anyone has any idea on how to make it work?

干杯!

推荐答案

我认为您可能会发现该事件已在scrollview控件中使用.您可以针对该控件覆盖javascript处理程序,以使其继续冒泡.

I think you might find that the event is consumed in the scrollview control. You can override the javascript handler against that control to allow it to keep bubbling.

要覆盖此功能,可以使用以下技术:覆盖JavaScript引用原始文件时功能

To override the function you can use this technique: Overriding a JavaScript function while referencing the original

快速浏览文件,看起来此方法可以为您提供所需的线索:

Having a quick look at the file, it looks like this method could hold clues as to what you want:

_handleDragMove:函数(e,ex,ey)

_handleDragMove: function(e, ex, ey)

具体是:

var svdir = this.options.direction; 如果(!this._directionLock)

var svdir = this.options.direction; if (!this._directionLock)

我正在使用此处显示的scrollview版本: http://jquerymobile .com/test/experiments/scrollview/scrollview-nested.html

I was using the version of scrollview shown here: http://jquerymobile.com/test/experiments/scrollview/scrollview-nested.html

这篇关于jQuery Mobile:滚动视图和滑动事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆