I want to place a scrolling marquee in my html title tag using jquery but don't know how and can't seem to find a good explanation online anywhere. Can someone help me please?
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
- how to get selected text from iframe with javascri
In Tatu Ulmanen's answer, there is a problem with space characters. As psarid stated as comment, after the first scroll, all of the spaces are removed.
This is because html parser trims texts. That means it removes the spaces at the end and at the beginning of the text. When title is scrolling, the title object in html looks like that:
As you can see above, we lost the space between words
Scrolling
andSpaces
. To prevent that, we need to store originaldocument.title
somewhere in our javascript code and put a space or something else to the end of it. Then, we can scrolldocument.title
by scrolling the text in the other variable. Here is the modified code of Tatu Ulmanen.Add the below script on your page head and then call the scrlsts() function on body onload
That's not very hard to do if you just want it to scroll like the
marquee
tag:That's pretty basic but should give you an idea on how to tweak it to your liking.