代码是在网上找的,忘记原出处了

/**
* 跑马灯自动切换
*/
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>'
}]
}]
}
});

最新文章

  1. C#中将DataTable转成List
  2. C++程序员如何入门Unreal Engine 4
  3. js调用.net后台事件、后台调用前台以及js调用服务器控件
  4. 高性能javascript学习笔记系列(2)-数据存取
  5. flex设置成1和auto有什么区别
  6. Oracle 中的游标(用Javase中Iterator 类比之)
  7. 读CopyOnWriteArrayList有感
  8. [C++] socket - 2 [UDP通信C/S实例]
  9. 实验箱FPGA部分测试报告及A8与FPGA链接测试报告
  10. 条款2:尽量以const、enum、inline替换#define
  11. java.util.regex.PatternSyntaxException: Unexpected internal error near index 1 \ ^
  12. Python 操作 MySQL--(pymysql)
  13. iTunes Store:隐藏和取消隐藏已购项目
  14. npx命令介绍
  15. 关于各种工具输入参数中&quot;-&quot;和&quot;--&quot;
  16. [Swift]LeetCode907. 子数组的最小值之和 | Sum of Subarray Minimums
  17. Python——SQLite
  18. 2种方式解决vue路由跳转未匹配相应路由避免出现空白页面或者指定404页面
  19. ASP.NET Core 中使用EF Core 将实体映射到数据库表的方法(SQL Server)
  20. 【Linux常见问题】Centos7的网络配置问题

热门文章

  1. CSS3小清新下拉菜单 简易大方
  2. linux的awk命令解读
  3. 最简单的视音频播放演示样例3:Direct3D播放YUV,RGB(通过Surface)
  4. vue、vuex、iview、vue-router报错集锦与爬坑记录
  5. Android开发学习笔记-GridView的动态显示
  6. c++const关键字---15
  7. [转]WPF入口Application
  8. DropDownListFor的种种纠结(禁止转载)
  9. ios开发之--调试方法
  10. Anaconda本地安装python库