Quick script: scrolling page titles
I wanted to do something different, but it seems I'll need a bit more time to figure it out, so in the meantime, have this quick little script!
What do you do when your page title is too long to fit in the tab? Why, scroll it of course!
I've noticed some of the Neocitizens have had their page titles scroll like a little news feed, so I figured I'd share the script with those who don't know how to do it yet.
The concept is pretty simple:
- Set up a timer.
- Take the first character of the page title and put at the end of the string.
- Every tick, change the page title to the new string.
Sounds easy enough, lets see how to implement it:
- You don't need jQuery for this one!
If you haven't gotten yourself a <script> tag yet, place one right before the </body> tag like so:
If you do have an existing <script> tag just copy the JS code inside! Don't forget the spaces before and after your text, otherwise your title may end up sticking to itself.
And this is pretty much it! If you need any help setting up or found any errors, please let me know! For the next article I want to try interacting with the Neocities API and see what kind of goodies we can get on our websites. In the meantime, don't mind any test pages I make, unless you want a sneak peek. Hope this article was of use.