首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

Sencha Touch 二 Carousel 模仿list itemtap

2012-07-31 
Sencha Touch 2Carousel 模仿list itemtap/*** @Author sai*Carousel 模仿list itemtap事件 */ Ext.define

Sencha Touch 2 Carousel 模仿list itemtap

/**  * @Author sai  *  Carousel 模仿list itemtap事件 */ Ext.define('SmartMenu.view.tips.Carousel', {extend: 'Ext.Carousel',xtype:'myCarousel',requires: ['Ext.carousel.Carousel',],config: { direction: 'horizontal',  listeners: {'initialize':function(carousel){Ext.getStore('Pictures').load(function(pictures) {var myitems = [];Ext.each(pictures, function(picture) {if (!picture.get('image_url')) {return;}myitems.push({xtype:'panel',     listeners : {            painted : function(panel) {                var el = panel.element;                    el.on('tap', function(e, t) {                                               this.getParent().onTap(picture.data.id);                    }, panel);            }        },items:[{html:'<img src="'+picture.data.image_url[0]+'"/>'+'<br>'+picture.data.title  }      ]});}); carousel.setItems(myitems);                               setInterval(function(){if(i<carousel.getItems().length)    {        i+=1;        carousel.setActiveItem(i);    }    else    {    carousel.setActiveItem(0);      i=0;    }},1000);});}},},onTap:function(id){//debugger; var  store= Ext.getStore('Pictures'); var data=store.findRecord('id',id).getData();var menu= Ext.create('SmartMenu.view.tips.SeasonDetails',{fullscreen: true,data: data}); Ext.getCmp('home_nav').setActiveItem(menu);}});

热点排行