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; }); });