How to?
| musashi9 |
|
|---|---|
|
Hello I want to load a random logo in my header but I have no idea how to This is what I have in my css............
#header { and this is from my header.tpl............
<div id="header"> </div> How can I get it to load a random image ? |
| GHengeveld |
|
|---|---|
|
Easiest solution is to use JavaScript:
<script type="text/javascript">
$(function() {
var logos = ["../img/logo1.png", "../img/logo2.png", "../img/logo3.png"];
$('#header').css('background-image', 'url(' + logos[Math.floor(Math.random()*logos.length)] + ')');
});
</script>
Put it in header.tpl, right before </head> |
| musashi9 |
|
|---|---|
|
Excelent works like a charm, thanks! |
| elfrenazo |
|
|---|---|
|
very good code |