Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49
» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21
» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28
» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15
» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11
» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24
» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58
» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50
» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22
» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12
» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10
» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51
» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11
» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19
» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34
by Ange Tuteur Tue 03 Sep 2019, 11:49
» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21
» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28
» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15
» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11
» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24
» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58
» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50
» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22
» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12
» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10
» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51
» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11
» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19
» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34
Recent Tutorials
Top posting users this month
Top Achievers
Who is online?
In total there are 34 users online :: 0 Registered, 0 Hidden and 34 Guests :: 2 Bots
None
Most users ever online was 515 on Tue 14 Sep 2021, 15:24
None
Most users ever online was 515 on Tue 14 Sep 2021, 15:24
Randomize your forum banner
Page 1 of 2 • Share
Page 1 of 2 • 1, 2
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.
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 :
Modifications
There's only one simple modification for you to make. At the top of the script you'll see and array of banners :
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 :
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 !
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 !
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, As FISH CRAZY mentioned, you can add as many banners as you want. Just make sure each one is separated by a comma.
Hello @Ange Tuteur
me and Fish crazy are using a code you gave some time back that sort of fits this but with a fade in and out
is something wrong with the code ?
me and Fish crazy are using a code you gave some time back that sort of fits this but with a fade in and out
- Code:
(function() {
var BannerRotator = {
images : [
'https://i37.servimg.com/u/f37/18/12/91/84/untitl44.png',
'https://i37.servimg.com/u/f37/18/12/91/84/untitl45.png',
'https://i37.servimg.com/u/f37/18/12/91/84/untitl46.png',
'https://i37.servimg.com/u/f37/18/12/91/84/untitl47.png',
],
start_delay : 5000,
duration : 5000,
height : '100%',
fade_image : true,
fade_speed : 1200,
keep_initial : false,
remember_position : true,
preload : true,
// technical data below
index : -1,
logo : null,
// increment the index and display the next image in rotation after a small delay
next : function(ms) {
if (ms === undefined) ms = FA.BannerRotator.duration;
window.setTimeout(function() {
if (++FA.BannerRotator.index >= FA.BannerRotator.images.length) FA.BannerRotator.index = 0; // reset index when it exceeds "images" length
if (FA.BannerRotator.remember_position) my_setcookie('fa_banner_index', FA.BannerRotator.index); // remember the last banner shown
// fade banner in and out
if (FA.BannerRotator.fade_image) {
$(FA.BannerRotator.logo).fadeOut(FA.BannerRotator.fade_speed, function() {
FA.BannerRotator.logo.src = FA.BannerRotator.images[FA.BannerRotator.index]; // set next banner
$(this).fadeIn(FA.BannerRotator.fade_speed, FA.BannerRotator.next); // fade it in
});
}
// default rotation
else {
FA.BannerRotator.logo.src = FA.BannerRotator.images[FA.BannerRotator.index];
FA.BannerRotator.next();
}
}, ms);
},
// initial start up to get the correct logo node and setup some other settings
init : function() {
var logo = document.getElementById('i_logo') || document.getElementById('logo') || document.getElementById('pun-logo'),
index = my_getcookie('fa_banner_index');
if (logo) {
FA.BannerRotator.logo = logo.tagName == 'IMG' ? logo : logo.firstChild;
FA.BannerRotator.logo.style.height = FA.BannerRotator.height;
if (FA.BannerRotator.keep_initial) FA.BannerRotator.images[FA.BannerRotator.images.length] = FA.BannerRotator.logo.src;
if (FA.BannerRotator.remember_position && index) {
FA.BannerRotator.index = +index;
FA.BannerRotator.logo.src = FA.BannerRotator.images[FA.BannerRotator.index] || FA.BannerRotator.images[0];
}
FA.BannerRotator.next(FA.BannerRotator.start_delay);
} else if (window.console && window.console.warn) {
console.warn('Your forum version is not optimized for this plugin');
}
}
};
if (!window.FA) FA = {};
if (!FA.BannerRotator) {
FA.BannerRotator = BannerRotator;
if (FA.BannerRotator.preload) {
for (var i = 0, j = FA.BannerRotator.images.length, img; i < j; i++) {
img = document.createElement('IMG');
img.src = FA.BannerRotator.images[i];
}
}
$(FA.BannerRotator.init);
}
}());
is something wrong with the code ?
- GuestGuest
That fixed the Quick reply but the one in the PM system is still the same but thank you for your help @Samantha NL
- GuestGuest
Ape wrote:That fixed the Quick reply but the one in the PM system is still the same but thank you for your help @Samantha NL
@Ape: Yw. Try changing the JS placement from 'All Pages' to 'HomePage' (or 'Index') + 'Sub-Forums' + 'Topics'. I haven't got the script running on my phpBB3 so I couldn't test it, but to me it's more logical to have it specified like that. I always consider the placement, I don't just copy & paste
@Ape I tested the script ( w/the correction Samantha mentioned ) on my test forum and it worked without any issues in the PM page. I believe another script on your forum -- most likely in all the pages -- is causing an error on the forum when viewing the PM page. Open your console ( F12 > Console / Right click > Inspect > Console ) to see if there are any JS errors.
This is what i get
- Code:
uncaught exception: Dimensions: jQuery collection is empty (unknown)
Use of getPreventDefault() is deprecated. Use defaultPrevented instead. jquery.min.js:3:7108
TypeError: jQuery(...).text(...).match(...) is null[Learn More] privmsg:737:29
TypeError: jQuery(...).text(...).match(...) is null[Learn More] privmsg:741:31
@Ape hmm.. would you mind providing me a test account for the forum ? It should give me a better picture of where the error is coming from.
Thanks !
From what I can tell, I don't *think* it's coming from JS codes management, but I'm not completely sure either. The error log in the console definitely isn't helping all too much. So I'd like you to try a few things to root out the cause :
1. Disable JS codes management and then check the send PM page to see if the editor is available.
2. If 1 doesn't work, try forcing the default templates.
Let me know if any of the above solutions return the editor.
From what I can tell, I don't *think* it's coming from JS codes management, but I'm not completely sure either. The error log in the console definitely isn't helping all too much. So I'd like you to try a few things to root out the cause :
1. Disable JS codes management and then check the send PM page to see if the editor is available.
2. If 1 doesn't work, try forcing the default templates.
Let me know if any of the above solutions return the editor.
- GuestGuest
@Ape, switch it back on and switch on the rotating banner script 1st. Then, one by one, switch on each other JS and see what script is conflicting with the rotating banner script. When all are on and you left out the conflicting script it should still be running and you know where the fault is.
I see, that narrows it down then. Try ruling out which script it is via process of elimination ; checking the PM page every time when you disable each JS file.
ok i have worked out its this code thats messing it up but as its Fish crazys forum im not 100% sure what this code is it's in 2 parts
In all pages :
and
All pages:
the bottom code is not the problem its more the top one
if i turn the top one on the problem shows.
In all pages :
- Code:
$(document).ready(function(){
$('#one').liteAccordion({
onActivate : function() {
this.find('figcaption').fadeOut();
},
slideCallback : function() {
this.find('figcaption').fadeIn();
},
autoPlay : true,
pauseOnHover : true,
theme : 'dark',
rounded : true,
enumerateSlides : true
}).find('figcaption:first').show();
});
and
All pages:
- Code:
/*************************************************
*
* project: liteAccordion - horizontal accordion plugin for jQuery
* author: Nicola Hibbert
* url: http://nicolahibbert.com/horizontal-accordion-jquery-plugin
* demo: http://www.nicolahibbert.com/demo/liteAccordion
*
* Version: 1.1.3
* Copyright: (c) 2010-2011 Nicola Hibbert
*
/*************************************************/
(function($) {
$.fn.liteAccordion = function(options) {
// defaults
var defaults = {
containerWidth : 1142,
containerHeight : 224,
headerWidth : 48,
firstSlide : 1,
onActivate : function() {},
slideSpeed : 800,
slideCallback : function() {},
autoPlay : false,
pauseOnHover : false,
cycleSpeed : 6000,
theme : 'basic', // basic, light*, dark, stitch*
rounded : false,
enumerateSlides : false
},
// merge defaults with options in new settings object
settings = $.extend({}, defaults, options),
// define key variables
$accordion = this,
$slides = $accordion.find('li'),
slideLen = $slides.length,
slideWidth = settings.containerWidth - (slideLen * settings.headerWidth),
$header = $slides.children('h2'),
// core utility and animation methods
utils = {
getGroup : function(pos, index) {
if (this.offsetLeft === pos.left) {
return $header.slice(index + 1, slideLen).filter(function() { return this.offsetLeft === $header.index(this) * settings.headerWidth });
} else if (this.offsetLeft === pos.right) {
return $header.slice(0, index + 1).filter(function() { return this.offsetLeft === slideWidth + ($header.index(this) * settings.headerWidth) });
}
},
nextSlide : function(slideIndex) {
var slide = slideIndex + 1 || settings.firstSlide;
// get index of next slide
return function() {
return slide++ % slideLen;
}
},
play : function(slideIndex) {
var getNext = utils.nextSlide((slideIndex) ? slideIndex : ''), // create closure
start = function() {
$header.eq(getNext()).click();
};
utils.playing = setInterval(start, settings.cycleSpeed);
},
pause : function() {
clearInterval(utils.playing);
},
playing : 0,
sentinel : false
};
// set container heights, widths, theme & corner style
$accordion
.height(settings.containerHeight)
.width(settings.containerWidth)
.addClass(settings.theme)
.addClass(settings.rounded && 'rounded');
// set tab width, height and selected class
$header
.width(settings.containerHeight)
.height(settings.headerWidth)
.eq(settings.firstSlide - 1).addClass('selected');
// ie :(
if ($.browser.msie) {
if ($.browser.version.substr(0,1) > 8) {
$header.css('filter', 'none');
} else if ($.browser.version.substr(0,1) < 7) {
return false;
}
}
// set initial positions for each slide
$header.each(function(index) {
var $this = $(this),
left = index * settings.headerWidth;
if (index >= settings.firstSlide) left += slideWidth;
$this
.css('left', left)
.next()
.width(slideWidth)
.css({ left : left, paddingLeft : settings.headerWidth });
// add number to bottom of tab
settings.enumerateSlides && $this.append('<b>' + (index + 1) + '</b>');
});
// bind event handler for activating slides
$header.click(function(e) {
var $this = $(this),
index = $header.index($this),
$next = $this.next(),
pos = {
left : index * settings.headerWidth,
right : index * settings.headerWidth + slideWidth,
newPos : 0
},
$group = utils.getGroup.call(this, pos, index);
// set animation direction
if (this.offsetLeft === pos.left) {
pos.newPos = slideWidth;
} else if (this.offsetLeft === pos.right) {
pos.newPos = -slideWidth;
}
// check if animation in progress
if (!$header.is(':animated')) {
// activate onclick callback with slide div as context
if (e.originalEvent) {
if (utils.sentinel === this) return false;
settings.onActivate.call($next);
utils.sentinel = this;
} else {
settings.onActivate.call($next);
utils.sentinel = false;
}
// remove, then add selected class
$header.removeClass('selected').filter($this).addClass('selected');
// get group of tabs & animate
$group
.animate({ left : '+=' + pos.newPos }, settings.slideSpeed, function() { settings.slideCallback.call($next) })
.next()
.animate({ left : '+=' + pos.newPos }, settings.slideSpeed);
}
});
// pause on hover
if (settings.pauseOnHover) {
$accordion.hover(function() {
utils.pause();
}, function() {
utils.play($header.index($header.filter('.selected')));
});
}
// start autoplay, call utils with no args = start from firstSlide
settings.autoPlay && utils.play();
return $accordion;
};
})(jQuery);
the bottom code is not the problem its more the top one
if i turn the top one on the problem shows.
- GuestGuest
My best guess is 'left' is causing this, cuz #left has been reserved for the widgets.
Idk but it might be the fact that
is chained to that liteAccordion function.
I don't really know what calling that liteAccordion function does, so don't quote me on this.
|
I don't really know what calling that liteAccordion function does, so don't quote me on this.
- GuestGuest
Ace 1 wrote:Idk but it might be the fact thatis chained to that liteAccordion function.
- Code:
$.find()
I don't really know what calling that liteAccordion function does, so don't quote me on this.
... it calls for a roll of drums, for sure ...
Your assumption may be a bit preliminary...
- Sponsored content
Page 1 of 2 • 1, 2
Similar topics
Create an account or log in to leave a reply
You need to be a member in order to leave a reply.
Page 1 of 2
Permissions in this forum:
You cannot reply to topics in this forum