Is there any way of recognizing text overflow with JS and show the overflowing text in an animated way? For example, moving the text to the left, like the spotify widget:

You should be able to confirm a text requires scrolling if you use "scrollWidth > clientWidth " of the container - assuming it has overflow:hidden and you take margin, padding and borders into account. Look at element dimensions for a basic overview. To scroll the text you just have to give it a negative margin-left, or use a DIV with position:absolute inside a DIV with position:relative and give the inner one a negative left value (CSS).
lengthof the String and if it is more thanx(depends on your requirement) then replace the last three characters of the String by...