Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Header configuration & styling »

How can I change header to random rotate


  #1  
Old Aug 7, 2009, 09:26 PM
fretbuzz
 
9 posts · Apr 2009
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.
  #2  
Old Aug 8, 2009, 05:10 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Bookmarks

Tags
code, header, random, rotate

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to get a header image to rotate every 'N' seconds juggledad Header configuration & styling 49 May 22, 2011 04:01 PM
How to get the header images to rotate in a random fashion? ptuquoc Header configuration & styling 3 Jul 29, 2009 05:02 AM
Calling random images in the sidebar, similar to header cowgirlgeek Sidebars & Widgets 1 Jun 30, 2009 06:41 PM
Can Rotate Header and Resize Header work together? thetravelchronicle Forum How-To 10 Jun 24, 2009 07:24 PM
Header Images Fail to Rotate Yarrokon Header configuration & styling 10 Jun 8, 2009 10:17 AM


All times are GMT -6. The time now is 05:37 PM.


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