Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Header configuration & styling (http://forum.bytesforall.com/forumdisplay.php?f=15)
-   -   How can I change header to random rotate (http://forum.bytesforall.com/showthread.php?t=2868)

fretbuzz Aug 7, 2009 09:26 PM

How can I change header to random rotate
 
Here is the code:
Code:

<?php if (strpos($bfa_ata['configure_header'],'%image')!==FALSE AND
$bfa_ata['header_image_javascript'] != "0" ) { ?>

var HeaderImages = new Array(<?php echo implode(",", bfa_rotating_header_images()); ?>);
var t; var j = 0
var p = HeaderImages.length
<?php if ($bfa_ata['header_image_javascript_preload'] == "Yes") { ?>
var PreLoadImages = new Array()
for (i = 0; i < p; i++){
        PreLoadImages[i] = new Image()
        PreLoadImages[i].src = HeaderImages[i]
}
<?php } ?>
function RotateHeaderImages(){
        if (document.body){
                HeaderImageContainer = document.getElementById('imagecontainer');
                HeaderImageContainer.style.background = 'url(' + HeaderImages[j] + ') <?php echo $bfa_ata['headerimage_alignment']; ?> no-repeat';
                j = j + 1
                if (j > (p-1)) j=0
                t = setTimeout('RotateHeaderImages()', <?php echo $bfa_ata['header_image_javascript']; ?>000)
        }
}
window.onload = RotateHeaderImages;

<?php } ?>

What do I change?

Thanks.

juggledad Aug 8, 2009 05:10 AM

the loop is using 'j' as the id if the array image to display. eithor pick a randon number between 0 and 'i' for 'j' or resort the array some how each time thru the loop.


All times are GMT -6. The time now is 05:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.