gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 18:34:48 25 4
gpt4 key购买 nike

我不确定这里有多少人使用过 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com