// Start banner rotation function homepage_banner_rotation(timeout, position) { if(!position) { var position = 0; } $.getJSON("/data_feed/homepage_banners.php", { position: position }, function(banner){ var my_js = 'javascript:void(0);'; if(banner.link!='') { my_js = "window.location='"+banner.link+"'"; } $("", { alt: banner.name, load: function(){ $("#homepage_banner_inner").append($(this)); $("#homepage_banner_inner").animate( { left: "-690px" }, { queue: false, duration: 2000, easing: "easeInOutSine", complete: function() { window.setTimeout(function (a,b) { homepage_banner_rotation(timeout, banner.position); }, timeout); $("#homepage_banner img:nth-child(1)").remove(); $(this).css("left", "0px"); } }, function() { } ); }, src: "/image/homepage_banner/"+banner.image, style: 'cursor:pointer', onclick: my_js }); } ); } // End banner rotation $(document).ready(function(){ // Start banner rotation var homepage_banner_timeout = 7000; window.setTimeout(function (a,b) { homepage_banner_rotation(homepage_banner_timeout, 1); }, homepage_banner_timeout); // End banner rotation });