| 1 |
// $Id$
|
| 2 |
|
| 3 |
$(document).ready(function() {
|
| 4 |
var i;
|
| 5 |
var selector;
|
| 6 |
var settings;
|
| 7 |
|
| 8 |
// Add our custom easing function.
|
| 9 |
jQuery.easing["QuartEaseOut"] = function(p, t, b, c, d) {
|
| 10 |
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
| 11 |
};
|
| 12 |
|
| 13 |
// Waits until the height of the element that contains the carousel is
|
| 14 |
// greater than zero, then renders the carousel.
|
| 15 |
function renderCarouselOnHeight($e, settings) {
|
| 16 |
if ($e.height()) {
|
| 17 |
$e.jcarousel(settings);
|
| 18 |
}
|
| 19 |
else {
|
| 20 |
setTimeout(function(){ renderCarouselOnHeight($e, settings); }, 50);
|
| 21 |
}
|
| 22 |
}
|
| 23 |
|
| 24 |
for (i in Drupal.settings.jcarousel) {
|
| 25 |
selector = Drupal.settings.jcarousel[i]['selector'];
|
| 26 |
settings = Drupal.settings.jcarousel[i]['settings'];
|
| 27 |
|
| 28 |
// Render the carousel when the height is greater than zero. This prevents
|
| 29 |
// errors being spit out by the jCarousel plugin. An occurrence of this
|
| 30 |
// weird problem is at the "edit content" page of Panel Pages.
|
| 31 |
renderCarouselOnHeight($(selector), settings);
|
| 32 |
}
|
| 33 |
});
|