I'm starting a new project in HTML5 and I would like to put a background img in the header, in vdd I want to put 4 images and I want them to change on every page refresh, I do not want a slider, site see an image and in each loading of the page img change. I'm starting the project now and have not done anything yet so I have no code to post. Does anyone know something similar?
______ azszpr256954 ___
If you use only JavaScript, I would suggest the following:
Rename background files with names with sequential numbers:
%pre%
Then after your %code% , call the script:
%pre%
Note: Because images will be called by random numbers, it may be that the same image is loaded after a new page load. If avoiding this is of importance , you can create a %code% to prevent the same image from being loaded again at the next page load. For this the code changes:
%pre%
SIMULATION
Code only for test without refresh on page. Use one of the codes
above.
In the example below, click the Refresh button to change the background of %code% :
______ azszpr256951 ___
It can be with PHP as well. Try it
Put this in PHP:
%pre%
And this in css:
%pre%
Important, the name of the images should be "bg-0X.jpg" ok, if you want to add more imgs just put in the Array 'bg-05.jpg' and save the img in the folder.
[] 's
___