| 1 |
/* $Id: jcarousel.js,v 1.1.2.2.2.4 2009/02/19 16:50:43 robloach Exp $ */ |
/* $Id: jcarousel.js,v 1.1.2.2.2.5 2009/03/25 18:10:22 robloach Exp $ */ |
| 2 |
|
|
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 41 |
skin = ''; |
skin = ''; |
| 42 |
} |
} |
| 43 |
|
|
| 44 |
|
// Prepare callbacks for circular carousels |
| 45 |
|
if (options['wrap'] == 'circular') { |
| 46 |
|
var itemList = []; |
| 47 |
|
// Add item to storage list, then remove it from the HTML so the carousel has no length |
| 48 |
|
// The removing is necessary, otherwise the carousel will stop when it reaches the end |
| 49 |
|
$(selector + ' li').each(function(){ |
| 50 |
|
itemList.push($(this).html()); |
| 51 |
|
this.parentNode.removeChild(this); |
| 52 |
|
}); |
| 53 |
|
|
| 54 |
|
options['itemVisibleInCallback'] = { onBeforeAnimation: function(carousel, item, i, state, e) { |
| 55 |
|
jcarousel_itemVisibleInCallback(carousel, item, i, state, e, itemList); |
| 56 |
|
}}; |
| 57 |
|
|
| 58 |
|
options['itemVisibleOutCallback'] = { onAfterAnimation: jcarousel_itemVisibleOutCallback }; |
| 59 |
|
} |
| 60 |
|
|
| 61 |
// Create the countdown element on non-processed elements. |
// Create the countdown element on non-processed elements. |
| 62 |
$(selector + ':not(.jcarousel-processed)').addClass('jcarousel-processed' + skin).jcarousel(options); |
$(selector + ':not(.jcarousel-processed)').addClass('jcarousel-processed' + skin).jcarousel(options); |
| 63 |
}); |
}); |
| 64 |
}; |
}; |
| 65 |
|
|
| 66 |
|
function jcarousel_itemVisibleInCallback(carousel, item, i, state, e, items) { |
| 67 |
|
var idx = carousel.index(i, items.length); |
| 68 |
|
carousel.add(i, items[idx - 1]); |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
function jcarousel_itemVisibleOutCallback(carousel, item, i, state, e) { |
| 72 |
|
carousel.remove(i); |
| 73 |
|
} |