• 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.net

    I 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)
  • what is the code you put into header.php?
    or the full code of header.php?
    (please use the http://pastebin.com/ for any code longer than 10 lines)

    along with the corresponding CSS

    as far as i can see, the background image is a html img tag.

Viewing 1 replies (of 1 total)

The topic ‘How to use this code’ is closed to new replies.