Scroll sentence in browser tab title

Found this little attention seeker and modified it to work with Hype.
Just call the following on document or scene load. It will start the title scroller right away. You can stop and start it later with the functions hypeDocument.stopChangingTitle and hypeDocument.startChangingTitle:

hypeDocument.startChangingTitle = function(str, ms){
	var index = 0;
	str = str || document.title+' ';
	str = str.replace(/\s/g, '\u2004');
	hypeDocument._changeTitleTimer = setInterval(function(){
		document.title =  str.substr(index) + str.substr(0, index);
		index = (index+1) % str.length;
	}, ms || 300);
}

hypeDocument.stopChangingTitle = function(){
	clearInterval(hypeDocument._changeTitleTimer);
}

hypeDocument.startChangingTitle('hello world, I am a scrolling title! ');
5 Likes

Thx for sharing MaxZieb!