You probably don't want to fadeOut() and then fadeIn() like that. Instead, you probably want to fadeIn() in the completion callback from fadeOut().
On Sat, Sep 5, 2009 at 4:46 PM, Calvin<cstephe...@gmail.com> wrote: > > I have some jquery code that does what I want it to do but I was > wondering if I could get some input/ suggestions/ opinions on how it > could be better. > > > Thanks for your time! > > here is the code: > > jQuery.fn.swapFade = function() { > if (this.is(':hidden')) { > this.fadeIn('slow'); > } else { > this.fadeOut('slow'); > } > > }; > > $(document).ready(function() { > > $('p').hide(); > var hash = {'one': 'a', 'two': 'b', 'three': 'c'} > > $('a').hover(function() { > $(this).fadeOut('slow') > $(this).fadeIn('slow'); > $('p.' + hash[this.className]).swapFade(); > > return false; > > }); > > }); -- Turtle, turtle, on the ground, Pink and shiny, turn around.