How to use this code
-
I got this code from CSS Tricks. It is supposed to rotate a series of background images. I put it in the Header of my site along with the corresponding CSS and it does not seem to be working. Not sure what I am doing wrong. Any Suggestions?
http://www.kamcheng.netI got the code from this site–
http://css-tricks.com/snippets/php/randomize-background-image/<?php $bg = array('bg-01.jpg', 'bg-02.jpg', 'bg-03.jpg', 'bg-04.jpg', 'bg-05.jpg', 'bg-06.jpg', 'bg-07.jpg' ); // array of filenames $i = rand(0, count($bg)-1); // generate random number size of the array $selectedBg = "$bg[$i]"; // set variable equal to which random filename was chosen ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘How to use this code’ is closed to new replies.