Commit 7de0f64e authored by tolleiv.nietsch's avatar tolleiv.nietsch

Improved the banner management to avoid that banners flicker too much.

git-svn-id: http://svn.t3o.typo3.org/extensions/projects/t3org/randombanners/trunk@1688 e8cb78a8-64f2-4011-8042-bd1ea5058d47
parent f7dd64d1
var banner_position_array = new Array();
function clickBanner(el) {
console.log('9');
$.ajax({
url: 'index.php?type=69&tx_randombanners_list[action]=show&tx_randombanners_list[banner]=' + parseInt($(el).attr('rel')) +'&tx_randombanners_list[controller]=Banner',
success: function(backData) {
......@@ -65,20 +66,13 @@ $(document).ready(function() {
});
}
if($(".gc .tx-randombanners").length > 0) {
banner_amount = $(".gc .tx-randombanners:first .tx-randombanners-item").length;
for(var banneri = 0; banneri < 4; banneri++){
if(banner_position_array[banneri] == ($(".banner"+banneri).length)-(1)){
banner_position_array[banneri] = 0;
$(".banner"+banneri+":last").removeClass("shown").fadeOut("slow",function(){
$(".banner"+banneri+":first").addClass("shown").fadeIn("slow");
});
}
else{
banner_position_array[banneri] = banner_position_array[banneri] + 1;
$(".banner"+banneri+":eq("+((banner_position_array[banneri])-(1))+")").removeClass("shown").fadeOut("slow", function(){
$(".banner"+banneri+":eq("+(banner_position_array[banneri])+")").addClass("shown").fadeIn("slow");
});
//alert(".banner"+(banneri)+":eq("+((banner_position_array[banneri])-(1))+"):"+".banner"+(banneri)+":eq("+(banner_position_array[banneri])+")");
}
current_banner = banner_position_array[banneri];
new_banner = banner_position_array[banneri] = (banner_position_array[banneri]+1)%banner_amount;
$(".banner"+banneri+":eq("+current_banner+")").data('banners', {banneri: banneri, new_banner: new_banner}).fadeOut("slow", function() {
$(".banner"+$(this).data('banners').banneri+":eq("+$(this).data('banners').new_banner+")").fadeIn("slow", function() { $(this).addClass("shown")});
});
}
}
});
......
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