sencha touch Carousel 自动切换
2014-04-24 17:55
267 查看
代码是在网上找的,忘记原出处了
使用:
/** * 跑马灯自动切换 */ Ext.define('ux.RotatingCarousel', { extend: 'Ext.carousel.Carousel', alternateClassName: 'rotatingCarousel', xtype: 'rotatingCarousel', config: { delay: 3000, start: true, listeners: { tap: { fn: function () { this.pause(); }, element: 'element' }, swipe: { fn: function () { this.start(); }, element: 'innerElement' } } }, initialize: function () { if (this.config.start) { this.start(); } }, rotate: function () { if (this.timeout) { clearTimeout(this.timeout); } if (this.getActiveIndex() === this.getMaxItemIndex()) { this.setActiveItem(0, 'slide'); } else { this.next(); } this.timeout = Ext.defer(this.rotate, this.config.delay, this); }, start: function (delayStart) { this.timeout = Ext.defer(this.rotate, delayStart || this.config.delay, this); }, pause: function (delayStart) { if (this.timeout) { clearTimeout(this.timeout); } if (delayStart) { this.start(delayStart); } return this; }, stop: function (delayStart) { this.pause(delayStart); this.setActiveItem(0, 'slide'); return this; } });
使用:
Ext.define('app.view.Home', { extend: 'Ext.Container', xtype: 'home', requires: ['ux.RotatingCarousel'], config: { items: [{ xtype: 'rotatingCarousel', height: '200px', items: [{ html: '<div class="homeImg" style="background-image:url(\'resources/images/lg1.png\')"></div>' }, { html: '<div class="homeImg" style="background-image:url(\'resources/images/lg2.png\')"></div>' }, { html: '<div class="homeImg" style="background-image:url(\'resources/images/lg3.png\')"></div>' }] }] } });
相关文章推荐
- Sencha Touch Carousel 自动切换
- sencha touch Carousel 自动切换
- Sencha Touch Carousel 自动切换
- Sencha Touch Carousel 自动切换
- sencha touch Carousel 自动切换
- sencha touch笔记——Carousel组件自动滚动实现及代码
- Sencha Touch 2 Card布局页面切换效果
- sencha touch 在安卓中横屏、竖屏切换 应用崩溃问题
- [Phonegap+Sencha Touch] 移动开发27、禁用iOS系统的webapp电话号码自动识别
- 【SENCHA TOUCH】页面动画跳转切换
- Sencha Touch下拉刷新、上拉自动加载
- Sencha Touch开发环境搭建及使用 Sencha Cmd 自动创建项目框架
- sencha touch 监控 Carousel 旋转事件
- sencha touch 在安卓中横屏、竖屏切换 应用崩溃问题
- Sencha Touch 之 DataView数据视图/走马灯(Carousel)
- Sencha touch Panel之间的跳转(如不使用TabPanel或者Carousel控件而产生跳转的动画效果)
- sencha touch carousel 扩展 CardList 可绑定data/store
- sencha touch 在安卓中横屏、竖屏切换 应用崩溃问题
- 如何在sencha touch中将选中的item状态自动变为不选中
- [Phonegap+Sencha Touch] 移动开发73 可以左右滑动切换的日历控件(带农历)