PDA

View Full Version : [OPEN] [FIXED][3.0 Core] Carousel itemSelector



Condor
4 Jul 2009, 6:14 AM
(very minor bug)

Setting the itemSelector to 'div', 'a' or 'h2' in a Carousel will destroy the inner markup, because the selector will match navigator elements.

The selection of items needs to be moved before the navigation elements are created:

Ext.override(Ext.ux.Carousel, {
initMarkup: function() {
var items = this.el.select(this.itemSelector);
var dh = Ext.DomHelper;
this.carouselSize = 0;
this.els.container = dh.append(this.el, {cls: 'ux-carousel-container'}, true);
this.els.slidesWrap = dh.append(this.els.container, {cls: 'ux-carousel-slides-wrap'}, true);
this.els.navigation = dh.append(this.els.container, {cls: 'ux-carousel-nav'}, true).hide();
this.els.caption = dh.append(this.els.navigation, {tag: 'h2', cls: 'ux-carousel-caption'}, true);
this.els.navNext = dh.append(this.els.navigation, {tag: 'a', href: '#', cls: 'ux-carousel-nav-next'}, true);
if(this.showPlayButton) {
this.els.navPlay = dh.append(this.els.navigation, {tag: 'a', href: '#', cls: 'ux-carousel-nav-play'}, true)
}
this.els.navPrev = dh.append(this.els.navigation, {tag: 'a', href: '#', cls: 'ux-carousel-nav-prev'}, true);
this.slideWidth = this.el.getWidth(true);
this.slideHeight = this.el.getHeight(true);
this.els.container.setStyle({
width: this.slideWidth + 'px',
height: this.slideHeight + 'px'
});
this.els.caption.setWidth((this.slideWidth - (this.els.navNext.getWidth()*2) - (this.showPlayButton ? this.els.navPlay.getWidth() : 0) - 20) + 'px')
items.appendTo(this.els.slidesWrap).each(function(item) {
item = item.wrap({cls: 'ux-carousel-slide'});
this.slides.push(item);
item.setWidth(this.slideWidth + 'px').setHeight(this.slideHeight + 'px');
}, this);
this.carouselSize = this.slides.length;
if(this.navigationOnHover) {
this.els.navigation.setStyle('top', (-1*this.els.navigation.getHeight()) + 'px');
}
this.el.clip();
}
});

Condor
9 Jul 2009, 7:00 AM
Not yet classified as [OPEN]

TommyMaintz
4 Aug 2009, 12:50 PM
Good catch, fixed in SVN.