Friday, January 29, 2010

Add Scrolling Text to Title Bar

How To Add Scrolling Text to Title Bar ?
1.Login to your blogger dashboard and go to Layout --> Page Elements.
2.Click on 'Add a Gadget' on the sidebar.
3.Select 'HTML/Javascript' and add the one of code given below and click save.

<script language=javascript>
var rev = "fwd";
function titlebar(val)
{
var msg  = "YOUR-TEXT-HERE";
var res = " ";
var speed = 100;
var pos = val;

msg = "   |--- "+msg+" ---|";
var le = msg.length;
if(rev == "fwd"){
 if(pos < le){
 pos = pos+1;
 scroll = msg.substr(0,pos);
 document.title = scroll;
 timer = window.setTimeout("titlebar("+pos+")",speed);
 }
 else{
 rev = "bwd";
 timer = window.setTimeout("titlebar("+pos+")",speed);
 }
}
else{
 if(pos > 0){
 pos = pos-1;
 var ale = le-pos;
 scrol = msg.substr(ale,le);
 document.title = scrol;
 timer = window.setTimeout("titlebar("+pos+")",speed);
 }
 else{
 rev = "fwd";
 timer = window.setTimeout("titlebar("+pos+")",speed);
 }
}
}

titlebar(0);
</script>

Now you are done.

0 Comments:

Post a Comment

 
top