Moving luffy sprite on the forum?
2 posters
Page 1 of 1
Moving luffy sprite on the forum?
I would like to know if it is possible to put a moving Luffy sprite right above the categories and forums? Want it to be small.
Re: Moving luffy sprite on the forum?
Hello @Swagbito,
Go to Administration Panel > Modules > JavaScript codes management > Create a new script
Title : Your choice
Placement : in the homepage
Paste the code below :
At the top are the following variables which you can edit.
leftImage : the image to display when the element is moving to the left
rightImage : the image to display when the element is moving to the right
speed : the speed at which the image moves
make sure that the url of your image is between quotes.
Go to Administration Panel > Modules > JavaScript codes management > Create a new script
Title : Your choice
Placement : in the homepage
Paste the code below :
- Code:
$(function() {
var leftImage = 'http://i59.servimg.com/u/f59/19/05/20/85/spin10.gif',
rightImage = 'http://i59.servimg.com/u/f59/19/05/20/85/spin10.gif',
speed = 40,
eliza = document.createElement('IMG'), pos = 'positive', node = document.getElementById('pun-visit');
if (!node) return;
eliza.src=rightImage;
eliza.setAttribute('style','position:relative;left:0%;bottom:0;');
node.parentNode.insertBefore(eliza,node);
window.setInterval(function(){
if (pos === 'positive') {
eliza.style.left = getLeft() + 1 + '%';
if (getLeft() >= 97) pos = 'negative', eliza.src = leftImage;
} else if (pos === 'negative') {
eliza.style.left = getLeft() - 1 + '%';
if (getLeft() <= 0) pos = 'positive', eliza.src = rightImage;
}
},speed);
function getLeft() { return Number(eliza.style.left.replace(/%/,'')) }
});
At the top are the following variables which you can edit.
leftImage : the image to display when the element is moving to the left
rightImage : the image to display when the element is moving to the right
speed : the speed at which the image moves
make sure that the url of your image is between quotes.
Similar topics
» Moving Items on the Forum
» Moving old forum from SMF
» Moving the forum,
» Moving existing forum
» Moving forum content to IPB
» Moving old forum from SMF
» Moving the forum,
» Moving existing forum
» Moving forum content to IPB
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum