I have this snippet of code I wrote for fading an element out and a new element in when a link is clicked. It is working but it is kind of twitchy and sometimes it flashes before the change and the position moves…Try it for yourself and click back and forth between the links…Oh I am seeing these glitches in firefox…
Have a look here. http://jsfiddle.net/XHXpt/2/
It’s glitching because the already hidden
<p>elements finish their animations immediately and call thecompletecallback you specified. You can prevent this by fading only the:visibleone, so those already-hidden ones don’t do anything, by changing this:To this:
You can test out the updated version here.