this can be resolved if you removed the absolute positioning #text1 and #text2 .
and make #text2 overlap #text1 , making both float:left and setting margin-left:-30px for #text2 .
now test it: http://jsfiddle.net/RPe4H/
now the problem is that when #text1 switched, #text2 will float in the upper left corner of #container , this happens because jQuery sets display:none on the element when going over.
Now, to solve this problem, put # text1 and # text2 inside containers with the same width, so #text does not affect the stream when it is set to display:none , you must also set min-height:1px to container #text1 .
now it works as expected http://jsfiddle.net/MyyF6/1/
source share