javascript - 在 Sencha Touch 中更改轮播页面时触发运行函数

标签 javascript extjs sencha-touch

我不确定这里有多少人使用过 Sencha Touch js 库,但我有一个问题,尽管我进行了多次尝试并失败了,但这个问题必须很简单。 基本上,我有一个轮播,当您滑动时可以对结果进行分页,并且我想在每次显示新页面时触发一个函数。
有人知道如何做到这一点吗?我尝试为其添加监听器,但由于某种原因不起作用。 像这样的事情:

var apCarousel = new Ext.Carousel({
            direction: 'horizontal',
            activeItem: 0,
            ui: 'dark',
            itemId  :   "apCarousel",
            items: pageItems,
            listeners   :   {
                click   :   {
                    element :   this,
                    fn  :   function(){alert('yo!');}
                }
            }
        });

任何帮助将不胜感激。 谢谢。

最佳答案

使用卡片切换事件:

Ext.setup({
    onReady: function(){
        new Ext.Carousel({
            fullscreen: true,
            listeners: {
                cardswitch: function(container, newCard, oldCard, index){
                    console.log(container, newCard, oldCard, index);
                }
            },
            items: [{
                html: 'a'
            },{
                html: 'b'
            },{
                html: 'c'
            }]
        });
    }
});

关于javascript - 在 Sencha Touch 中更改轮播页面时触发运行函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4270251/

相关文章:

list - Sencha 触摸 2.1 : Allowing horizontal overflow on a vertical list

javascript - Highcharts 中的子弹图配置

prototype - javascript 库原型(prototype)函数没有一个接一个地执行

javascript - HTML 表格中的条件警报

extjs - 在网格面板标题内添加组合框......标题所在的位置

sencha-touch - Sencha Touch 中 doLayout() 和 doComponentLayout() 之间的区别?

ios - iOS 开发框架基准

html - Sencha Touch/HTML5 从左到右滑动事件/效果

Javascript:如何以毫秒计算一天的开始?

extjs - Pimcore Extjs 如何覆盖不同插件中的相同方法