Once Again: Background :)

GK User
Thu Aug 28, 2014 5:41 pm
Hey there,

i'm very new on Joomla (and making a website too ;) ) and trying to make the background in the header auto change... for example every time i visit the page the template should loud randomly header_bg1, header_bg2,....

I searched for something like this, but dont know where i should insert this code and if it works.

Code: Select all
<script  type="text/javascript">
      function changeImg(imgNumber)   {
         var myImages = ["images/image0.jpg", "images/image1.jpg", "images/image2.jpg", "images/image3.jpg"];
         var imgShown = document.body.style.backgroundImage;
         var newImgNumber =Math.floor(Math.random()*myImages.length);
         document.body.style.backgroundImage = 'url('+myImages[newImgNumber]+')';
      }
      window.onload=changeImg;
   </script>
   <style type="text/css">
      .bg {background-attachment:fixed; background-repeat: no-repeat; background-position:top right;}
   </style>


thanks in advance :)
User avatar
Fresh Boarder

GK User
Fri Aug 29, 2014 10:43 am
If you don't know what you are doing there is a big chance you will not succeed.
I would suggest to put javascript code into templates/gk_steakhouse/js/gk.scripts.js file and css into templates/gk_steakhouse/css/override.css but you have to know what you are doing.
User avatar
Moderator


cron