Latest topics
» How To Install the Code Snippet Button
by SLGray Today at 20:56

» Select Button
by SLGray Today at 20:25

» FM Themes
by SLGray Today at 16:48

» User - Made Creations
by SLGray Today at 16:48

» The Football Forums
by Mati Today at 15:22

» [BUG] Avatar doesn't resize when reading the profile
by Samantha NL Today at 12:33

» Search Bar Options
by Samantha NL Today at 11:38

» Chit Chat Thread
by Jazeon Today at 05:42

» Christmas logo
by Teo! Today at 03:56

» SyncEditor
by keko_ferkeko Today at 00:31

» Private message bg color
by Mr.Alam Yesterday at 22:54

» Multi-step Login Form
by Samantha NL Yesterday at 12:54

» Member of the Month
by Samantha NL Yesterday at 12:38

» Forumactif Edge - Dutch Translation
by Samantha NL Yesterday at 10:49

» Widget : Staff Online
by Samantha NL Yesterday at 10:39

Recent Tutorials
Who is online?
In total there are 3 users online :: 0 Registered, 0 Hidden and 3 Guests :: 1 Bot

None

[ View the whole list ]


Most users ever online was 172 on Fri 19 Feb 2016, 05:17

Randomize your forum banner

View previous topic View next topic Go down

Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8396
Reputation : 2010
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Thu 29 Jan 2015, 01:50

This simple trick will allow you to display multiple banners on your forum at random. Only one banner will be shown at once, but it will be different each time you change or reload the page. This trick will work for any forum version. Smile



Installation

Go to Administration Panel > Modules > JavaScript codes management, and create a new script.

Title : Random banner
Placement : In all the pages
Paste the following code :
Code:
$(function() {
  var banners = [
    'http://i38.servimg.com/u/f38/18/21/60/73/b010.png',
    'http://i38.servimg.com/u/f38/18/21/60/73/b110.png',
    'http://i38.servimg.com/u/f38/18/21/60/73/b210.png',
    'http://i38.servimg.com/u/f38/18/21/60/73/b310.png',
    'http://i38.servimg.com/u/f38/18/21/60/73/b410.png',
    'http://i38.servimg.com/u/f38/18/21/60/73/b510.png'
  ],

  logo = document.getElementById('i_logo') || document.getElementById('logo') || document.getElementById('pun-logo');
  (logo.tagName == 'IMG' ? logo : logo.firstChild).src = banners[Math.floor(Math.random() * banners.length)];
});

Modifications

There's only one simple modification for you to make. At the top of the script you'll see and array of banners :
Code:
  var banners = [
    'http://i38.servimg.com/u/f38/18/21/60/73/b010.png',
    'http://i38.servimg.com/u/f38/18/21/60/73/b110.png',
    'http://i38.servimg.com/u/f38/18/21/60/73/b210.png',
    'http://i38.servimg.com/u/f38/18/21/60/73/b310.png',
    'http://i38.servimg.com/u/f38/18/21/60/73/b410.png',
    'http://i38.servimg.com/u/f38/18/21/60/73/b510.png'
  ],

You can replace or delete these image URLs, and add your own. Multiple banners should be separated by a comma, and the banner URL should be between quotes ! Here's an example of only two banners :
Code:
  var banners = [
    'http://i38.servimg.com/u/f38/18/21/60/73/b010.png',
    'http://i38.servimg.com/u/f38/18/21/60/73/b110.png'
  ],

As you can see, you can have as little or as many banners as you want ! If you have any comments or questions, you may leave them below. Have fun ! Mr. Green


Notice
Tutorial written by Ange Tuteur.
Reproduction not permitted without consent from the author.


Last edited by Ange Tuteur on Tue 15 Mar 2016, 06:21; edited 1 time in total
Michael_vx

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1373
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Wed 04 Feb 2015, 15:22

thanks a lot in the 1st place
i like also to ask about something
can i add more banners i see 6 banners in the script
so if i added more links is it still okay or still other mode needed ?
FISH CRAZY

Title :
Gender : Male
Posts : 30
Points : 803
Reputation : 12
Location : USA
Language : English / German
Browser : Browser : Internet Explorer Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://fishcrazyaquatics.4umotion.com/ https://www.facebook.com/https://www.facebook.com/pages/Fish-Crazy-Aquatics/4726729494127

PostFISH CRAZY on Wed 04 Feb 2015, 16:57

I am running 10 banners on my forum and it has been running now for 9 months grate
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4091
Points : 8396
Reputation : 2010
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Wed 04 Feb 2015, 19:26

@Michael_vx, As FISH CRAZY mentioned, you can add as many banners as you want. Just make sure each one is separated by a comma. Smile
brandon_g

Title :
Gender : Unspecified
Age : 19
Posts : 431
Points : 1330
Reputation : 62
Location : USA
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB2
Awards :
View all awards
View user profile http://broadcastingduo.forumotion.com

Postbrandon_g on Thu 05 Feb 2015, 17:12

This refers to the banner on top?
FISH CRAZY

Title :
Gender : Male
Posts : 30
Points : 803
Reputation : 12
Location : USA
Language : English / German
Browser : Browser : Internet Explorer Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://fishcrazyaquatics.4umotion.com/ https://www.facebook.com/https://www.facebook.com/pages/Fish-Crazy-Aquatics/4726729494127

PostFISH CRAZY on Fri 06 Feb 2015, 00:21

Yes the top banner Wink
Michael_vx

Title :
Gender : Male
Age : 24
Posts : 290
Points : 1373
Reputation : 74
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
Awards :
View all awards
View user profile http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx on Fri 06 Feb 2015, 04:18

understand now bounce 
thanks a lot

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

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