【问题标题】:is it possible to override sencha touch carousel previous and next functions?是否可以覆盖 sencha touch carousel 上一个和下一个功能?
【发布时间】:2013-05-27 17:47:18
【问题描述】:

我正在使用sencha touch开发移动网站。

Ext.setup( {
    onReady: function() {

      new Ext.Carousel({
        fullscreen: true,
        items: [
          {
            html: "Item1"
},
{ 
  html : "Item2"
}
]});};});

是我使用的。但是是否可以覆盖 next() 和 prev() 函数。实际上我想在这些函数中做一些事情,然后调用 parent.next() 我的意思是相同的函数。 有什么帮助吗?? 我看到了链接http://www.sencha.com/forum/showthread.php?110036-Override-Method 但是我看不懂

【问题讨论】:

    标签: javascript sencha-touch carousel


    【解决方案1】:

    请参阅此代码以满足您的要求。

    Ext.Loader.setConfig({
        enabled: true
    });
    
    Ext.application({
        launch: function () {
            Ext.define('MyApp.view.inbox.MyInbox', {
                extend: 'Ext.Carousel',
                config: {
                    itemId:'test',
                    fullscreen: true,
                    items: [{
                        html: "Item1"
                    },{ 
                        html : "Item2"
                    }]
                },
                next:function(){
                    //Do your thing
    
                    //This code will call the next in the super class
                    this.callParent(arguments);
                },
                prev:function(){
                    //Do your thing
    
                    //This code will call the prev in the super class
                    this.callParent(arguments);
                }
            });
            Ext.create('MyApp.view.inbox.MyInbox');
        }
    });
    

    【讨论】:

    • 谢谢。我试过这段代码,但它根本没有进入 next 和 prev 函数。我猜它直接进入主要的 next 和 prev 函数
    • 好的,但在我的情况下我不想添加任何额外的按钮。我想覆盖下一个和上一个功能而不添加任何额外的按钮
    • 按钮只是为了显示调用了哪个函数。如果你调用 carousel 对象的 next(),我们的类 'next' 会被调用。我认为您指的是在轮播中滑动?
    猜你喜欢
    • 1970-01-01
    • 2013-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多