Different Branding every time
2 posters
Page 1 of 1
Different Branding every time
Hi, im using a branding on my forum but i want to make it change every time someone visits a new page in my forum.
If u check this: http://www.anime-greek.com/forums/index.php u will understand what i mean.. (just click again n again at their logo)
If u check this: http://www.anime-greek.com/forums/index.php u will understand what i mean.. (just click again n again at their logo)
Re: Different Branding every time
Hello,
You can use JavaScript random math to pick a random banner to display.
Administration Panel > Modules > JavaScript codes management > Create a new script
Title : your choice
Placement : in all the pages
Paste the code below and save :
We set a range from 0 - 4, but not including 4. So, Math.floor(Math.random() * 4) will have a chance of 0, 1, 2, and 3. Increase the value of four and add more conditions to display a wider range of banners.
Also replace /img.gif by the URL of your image.
You can use JavaScript random math to pick a random banner to display.
Administration Panel > Modules > JavaScript codes management > Create a new script
Title : your choice
Placement : in all the pages
Paste the code below and save :
- Code:
$(function() {
var rand = Math.floor(Math.random() * 4);
var logo = $('#logo img');
if (rand === 0) logo.attr('src','/img.gif');
if (rand === 1) logo.attr('src','/img.gif');
if (rand === 2) logo.attr('src','/img.gif');
if (rand === 3) logo.attr('src','/img.gif');
});
We set a range from 0 - 4, but not including 4. So, Math.floor(Math.random() * 4) will have a chance of 0, 1, 2, and 3. Increase the value of four and add more conditions to display a wider range of banners.
Also replace /img.gif by the URL of your image.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum