/*<![CDATA[*/
// when the DOM is ready...
$(document).ready(function () {
var $panels = $('.tx-kiwislider-pi1 .scrollContainer > div')
var $startID = Math.floor(Math.random() * $panels.length)
var $panel = $panels.get($startID);
var $alphaID = '#'+$panel.id.replace(/panel/g, 'alpha');
var $maxHeight = 0;
$('.alpha').each(function() {
var $css = (-1)*$maxHeight;
$(this).css({'position' : 'relative', 'top' : $css});
$(this).stop().animate({ opacity: 0.00 }, 0);
$maxHeight += $(this).height();
});
jQuery($($alphaID)).stop().animate({ opacity: 1.00 }, 1000*2);
var $container = $('.tx-kiwislider-pi1 .scrollContainer');
// if false, we'll float all the panels left and fix the width
// of the container
var horizontal = true;
// float the panels left if we're going horizontal
if (horizontal) {
$panels.css({
'float' : 'left',
'position' : 'relative' // IE fix to ensure overflow is hidden
});
// calculate a new width for the container (so it holds all panels)
$container.css('width', $panels[0].offsetWidth * $panels.length);
}
// collect the scroll object, at the same time apply the hidden overflow
// to remove the default scrollbars that will appear
var $scroll = $('.tx-kiwislider-pi1 .scroll').css('overflow', 'hidden');
// apply our left + right buttons
$scroll
.before('<img class="scrollButtons left" src="fileadmin/newsite/template/images/arrow-left.png">')
.after('<img class="scrollButtons right" src="fileadmin/newsite/template/images/arrow-right.png">');
function trigger(data) {
$alphaID = '#'+data.id.replace(/panel/g, 'alpha');
$($alphaID).stop().animate({opacity: 1}, 1000);
}
function beforeTrigger() {
$($alphaID).stop().animate({ opacity: 0}, 1000);
}
// offset is used to move to *exactly* the right place, since I'm using
// padding on my example, I need to subtract the amount of padding to
// the offset. Try removing this to get a good idea of the effect
var offset = parseInt((horizontal ?
$container.css('paddingTop') :
$container.css('paddingLeft'))
|| 0) * -1;
var scrollOptions = {
target: $scroll, // the element that has the overflow
// can be a selector which will be relative to the target
items: $panels,
start: $startID,
force : true,
// selectors are NOT relative to document, i.e. make sure they're unique
prev: 'img.left',
next: 'img.right',
// allow the scroll effect to run both directions
axis: 'xy',
onAfter: trigger, // our final callback
onBefore: beforeTrigger, // the first trigger
offset: offset,
// duration of the sliding effect
duration: 1000,
// easing - can be used with the easing plugin:
// http://gsgd.co.uk/sandbox/jquery/easing/
easing: 'swing',
step:1 // set the number of itmes to be slide
};
// apply serialScroll to the slider - we chose this plugin because it
// supports// the indexed next and previous scroll along with hooking
// in to our navigation.
$('.tx-kiwislider-pi1').serialScroll(scrollOptions);
// Start the automatic of the slideshow
var $auto_refresh = setInterval(
function ()
{
$('.right').trigger('click');
}, 5000
); // refresh every 10000 milliseconds
// Refresh the css of the Slider
$('.alpha').beResetCSS();
});
/*]]>*/
</script>