You are viewing our Forum Archives. To view or take place in current topics click here.
[JS] Website Title Looping Script
Posted:

[JS] Website Title Looping ScriptPosted:

-Jordan-
  • TTG Addict
Status: Offline
Joined: Jul 12, 201013Year Member
Posts: 2,684
Reputation Power: 122
Status: Offline
Joined: Jul 12, 201013Year Member
Posts: 2,684
Reputation Power: 122
This is just a little script which keeps the page title looping on a website. What I mean by this is when, for example, you receive a chat message on Facebook and the title switches between "Facebook" and "XXX sent you a message" in a continuous loop.

I hope you find this somewhat useful anyway. Please also feel free to post any enhancements upon the script which you come up with

[ Register or Signin to view external links. ]
function title_loop () {

   cycle_count === title_count ? cycle_count = 0 : false;

   document.title = titles[cycle_count];
   cycle_count++;

   setTimeout(function() {

      title_loop();

   }, 250); //<-- determines interval

}

//The titles to loop through
titles = [
   'Facebook',
   'Joe Bloggs sent you a message'
];

title_count = titles.length;
cycle_count = 0;

title_loop();

The following 3 users thanked -Jordan- for this useful post:

-ScHmIdTy (03-11-2012), Tea (01-29-2012), iPatobo (01-29-2012)
#2. Posted:
iPatobo
  • TTG Contender
Status: Offline
Joined: Sep 05, 201013Year Member
Posts: 3,218
Reputation Power: 209
Status: Offline
Joined: Sep 05, 201013Year Member
Posts: 3,218
Reputation Power: 209
Nice script Jordan, I'll definitely find a use for this in the future.

Keep up the good work
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.