Commit f1887d4f authored by Sven Franck's avatar Sven Franck

libs: JQM/extensions, carousel bugfixes

parent 719d051e
......@@ -42,13 +42,14 @@
border-radius: inherit;
}
/* Transition positioning (1-3 images only at the moment) */
/* Transition positioning */
.ui-carousel li:not(.ui-carousel-active) {
right: -200%;
}
.ui-carousel li.ui-carousel-active:nth-child(1):nth-last-child(3) {
right: 0%;
},
}
.ui-carousel li.ui-carousel-active:nth-child(2):nth-last-child(1),
.ui-carousel li.ui-carousel-active:nth-child(1):nth-last-child(3) ~ li {
right: 100%;
}
......
......@@ -23,22 +23,34 @@ $.widget( "mobile.carousel", $.extend( {
},
refresh: function ( create ) {
var el = this.element,
var $inputs, $items, i,
el = this.element,
o = this.options;
if ( !o.thumbnails ) {
if ( !o.enhanced ) {
// clear barrel on refesh
if ( !create ) {
$( "#ui-carousel-barrel-" + this.uuid ).remove();
}
// generate UI and barrel and append to DOM
this._enhance( el, o );
el.parent()[ o.bulletsPos === "top" ? "prepend" : "append" ]( this._barrel );
} else {
this._barrel = $( "#" + o.barrel );
}
this._on( this._barrel.find( "input" ), {
$inputs = this._barrel.find( "input" );
$items = this._items = this._getItems( "li" );
this._len = $items.length;
this._direction = "";
// set reference on radio buttons
for (i = 0; i < this._len; i += 1) {
$inputs.eq( i ).data( "reference", $items.eq( i ) );
}
this._on( $inputs, {
"click": "_change"
});
......@@ -58,10 +70,6 @@ $.widget( "mobile.carousel", $.extend( {
}
});
}
this._items = this._getItems( "li" );
this._len = this._items.length;
this._direction = "";
},
_onKeyPress: function ( e ) {
......@@ -195,9 +203,7 @@ $.widget( "mobile.carousel", $.mobile.carousel, {
if ( o.bullets ) {
label = $( "<label data-" + $.mobile.ns + "iconpos='notext'></label>" );
radio = $( "<input type='radio' name='" + prefix + "' id='" +
prefix + "-" + i + "' value='" + i + "'/>" )
// set item as reference
.data( "reference", $( item ) );
prefix + "-" + i + "' value='" + i + "'/>" );
if ( i === 0 ) {
radio.attr( "checked", true );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment