Sencha touch:: 使 TabPanel 始终向左滑动

发布于 2024-11-09 12:40:38 字数 48 浏览 0 评论 0原文

有没有办法让 TabPanel 始终在 sencha touch 中向“左”滑动?

Is there any way to make a TabPanel always slide 'left' in sencha touch?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天涯沦落人 2024-11-16 12:40:38

我认为你会做类似的事情(抱歉,现在无法测试):

new Ext.TabPanel({
fullscreen: true,
defaults:{animation: new Ext.Anim({
    direction: 'left',
    cover: false,
    reveal: false,

    before: function(el) {
        var curZ = el.getStyle('z-index') == 'auto' ? 0 : el.getStyle('z-index'),
            zIndex = curZ + 1,
            toX = 0,
            toY = 0,
            fromX = 0,
            fromY = 0,
            elH = el.getHeight(),
            elW = el.getWidth();

        if (this.direction == 'left' || this.direction == 'right') {
            if (this.out == true) {
                toX = -elW;
            }
            else {
                fromX = elW;
            }
        }
        else if (this.direction == 'up' || this.direction == 'down') {
            //if (this.out == true) {
            //    toY = -elH;
            //}
            //else {
                fromY = elH;  //Always slide to the left???
            //}
        }

        if (this.direction == 'right' || this.direction == 'down') {
            toY *= -1;
            toX *= -1;
            fromY *= -1;
            fromX *= -1;
        }

        if (this.cover && this.out) {
            toX = 0;
            toY = 0;
            zIndex = curZ;
        }
        else if (this.reveal && !this.out) {
            fromX = 0;
            fromY = 0;
            zIndex = curZ;
        }

        this.from = {
            '-webkit-transform': 'translate3d(' + fromX + 'px, ' + fromY + 'px, 0)',
            'z-index': zIndex,
            'opacity': 0.99
        };
        this.to = {
            '-webkit-transform': 'translate3d(' + toX + 'px, ' + toY + 'px, 0)',
            'z-index': zIndex,
            'opacity': 1
        };
    }
})
},
items: [
    {
        title: 'Tab 1',
        html : '1',
        cls  : 'card1'
    },
    {
        title: 'Tab 2',
        html : '2',
        cls  : 'card2'
    },
    {
        title: 'Tab 3',
        html : '3',
        cls  : 'card3'
    }
]
});

I think you do something like (sorry, can't test it right now):

new Ext.TabPanel({
fullscreen: true,
defaults:{animation: new Ext.Anim({
    direction: 'left',
    cover: false,
    reveal: false,

    before: function(el) {
        var curZ = el.getStyle('z-index') == 'auto' ? 0 : el.getStyle('z-index'),
            zIndex = curZ + 1,
            toX = 0,
            toY = 0,
            fromX = 0,
            fromY = 0,
            elH = el.getHeight(),
            elW = el.getWidth();

        if (this.direction == 'left' || this.direction == 'right') {
            if (this.out == true) {
                toX = -elW;
            }
            else {
                fromX = elW;
            }
        }
        else if (this.direction == 'up' || this.direction == 'down') {
            //if (this.out == true) {
            //    toY = -elH;
            //}
            //else {
                fromY = elH;  //Always slide to the left???
            //}
        }

        if (this.direction == 'right' || this.direction == 'down') {
            toY *= -1;
            toX *= -1;
            fromY *= -1;
            fromX *= -1;
        }

        if (this.cover && this.out) {
            toX = 0;
            toY = 0;
            zIndex = curZ;
        }
        else if (this.reveal && !this.out) {
            fromX = 0;
            fromY = 0;
            zIndex = curZ;
        }

        this.from = {
            '-webkit-transform': 'translate3d(' + fromX + 'px, ' + fromY + 'px, 0)',
            'z-index': zIndex,
            'opacity': 0.99
        };
        this.to = {
            '-webkit-transform': 'translate3d(' + toX + 'px, ' + toY + 'px, 0)',
            'z-index': zIndex,
            'opacity': 1
        };
    }
})
},
items: [
    {
        title: 'Tab 1',
        html : '1',
        cls  : 'card1'
    },
    {
        title: 'Tab 2',
        html : '2',
        cls  : 'card2'
    },
    {
        title: 'Tab 3',
        html : '3',
        cls  : 'card3'
    }
]
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文