Javascript 如何在Ext Touch(Sencha Touch)中处理Ext.面板上的滚动事件?

Javascript 如何在Ext Touch(Sencha Touch)中处理Ext.面板上的滚动事件?,javascript,extjs,Javascript,Extjs,我有两个外部面板,一个是scrollingContent,另一个是wrapper。包装器比scrollingContent小,所以后者在包装器内水平滚动 我想在每次滚动后处理滚动事件和scrollingContent在包装器中的位置 我没有找到任何解决办法。任何帮助都将不胜感激 提前谢谢 var scrollingContent = new Ext.Panel({ id: 'p1', layout: 'hbox', width: 1200, height: 380

我有两个外部面板,一个是scrollingContent,另一个是wrapper。包装器比scrollingContent小,所以后者在包装器内水平滚动

我想在每次滚动后处理滚动事件和scrollingContent在包装器中的位置

我没有找到任何解决办法。任何帮助都将不胜感激

提前谢谢

var scrollingContent = new Ext.Panel({
    id: 'p1',
    layout: 'hbox',
    width: 1200,
    height: 380,
    //cls: 'blue',
    items: itemList
});

var wrapper = new Ext.Panel({
    id: 'p2',
    scroll: 'horizontal',
    width: 800,
    height: 380,
    cls: 'gray',
    items: scrollingContent
});

要访问包装器的滚动事件,请在其呈现后访问其滚动器:

var wrapper = new Ext.Panel({
    id: 'p2',
    scroll: 'horizontal',
    width: 800,
    height: 380,
    cls: 'gray',
    items: scrollingContent,

    listeners: {
       afterrender: function(comp) {
          // comp is this Ext.Component == wrapper
          comp.scroller.on('scroll',handleScroll);
       }
    }
});

/**
* Called when wrapper scrolls
*/
function handleScroll(scrollerObject,offsetObject) {
     // Do your stuff here
}
请注意,此事件将持续触发,而不仅仅是在滚动启动时。如果需要该功能,请改用scrollstart事件

这里是我找到信息的地方:

有关Scroller类及其公开内容的更多信息,请参阅API文档:

要访问包装器的滚动事件,请在其呈现后访问其滚动程序:

var wrapper = new Ext.Panel({
    id: 'p2',
    scroll: 'horizontal',
    width: 800,
    height: 380,
    cls: 'gray',
    items: scrollingContent,

    listeners: {
       afterrender: function(comp) {
          // comp is this Ext.Component == wrapper
          comp.scroller.on('scroll',handleScroll);
       }
    }
});

/**
* Called when wrapper scrolls
*/
function handleScroll(scrollerObject,offsetObject) {
     // Do your stuff here
}
请注意,此事件将持续触发,而不仅仅是在滚动启动时。如果需要该功能,请改用scrollstart事件

这里是我找到信息的地方:

有关Scroller类及其公开内容的更多信息,请参阅API文档: