Give your <UL> tag an id 'menu', and replace your document.ready code with this: $(document).ready(function() { $('ul#menu li a').each (function () { $(this).append ('<span class="hover"></span>'); var $span = $('> span.hover', this).css('opacity', 0); $(this).hover (function () { $span.stop().fadeTo (500, 1); }, function () { $span.stop().fadeTo (500, 0); }); });
Jim Davis wrote: > I am adapting Greg-J's hover fade method > <http://greg-j.com/static-content/hover-fade-redux.html> to a > navigation menu. Demo of my menu is here: > > http://jimdavis.org/celtic/fadetest.php > > If you view the source code you will see that I repeat the jQuery > function for each menu item. Since this nav menu will have about 10 > items I want to change the script to use an array to minimize the > code. What needs to be changed to use an array? > > Jim > > >