Template:Ticker/doc

This template adds a ticker to any page.
 * Usage
 * message


 * Example
 * Bananas!


 * Code
 * This script requires JavaScript put in you MediaWiki:Common.js

/* Ticker */ var ticker; var tickertxt; var tickerdiv;

function newsticker { if (document.getElementById) { if ((document.getElementById('ticker'))&&(document.getElementById('tickerdiv'))&&(document.getElementById('tickertxt'))) { ticker = document.getElementById('ticker'); ticker.style.display = 'block'; tickerdiv = document.getElementById('tickerdiv'); tickertxt = document.getElementById('tickertxt').offsetWidth; tickerdiv.style.left = parseInt(ticker.style.width) + 10 + 'px'; lefttime=setInterval("newstickergo",200); } } }

function newstickergo { tickerdiv.style.left = (parseInt(tickerdiv.style.left) > (-10 - tickertxt) ) ? parseInt(tickerdiv.style.left) - 10 + "px" : parseInt(ticker.style.width) + 10 + "px"; } addOnloadHook(newsticker);