The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.

Create a free forum like this one.

Different Branding every time

View previous topic View next topic Go down

In progress Different Branding every time

Post by J0k3R^ on June 26th 2014, 11:22 am

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: will understand what i mean.. (just click again n again at their logo)


Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

Back to top Go down

In progress Re: Different Branding every time

Post by Ange Tuteur on June 26th 2014, 12:04 pm


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 :
$(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.

Ange Tuteur

Male Posts : 13023
Reputation : 2690
Language : EN10, FR5
Location : Pennsylvania

Back to top Go down

View previous topic View next topic Back to top

Permissions in this forum:
You cannot reply to topics in this forum