Erik,
  Nice of you to post this lesson for others, but I hate to say you
could have saved yourself lots of time with one simple line of code.

jquery.noConflict();

http://docs.jquery.com/Core/jQuery.noConflict

This gives control of the $ namespace back to whichever library calls
it. By loading mooTools first, then jQuery, including this line first
in your personal JS file and then using the namespace jquery() instead
of $() you would not have needed to change your namespace and your
hide function. In fact I highly suggest you refactor your work to
include this so that as you move forward you can upgrade jquery
without having to do all that work again.

#2. A Couple suggestions.... By not using an anchor you are making the
site difficult to use for people with disabilities that use screen
readers or keyboard navigation as it is not clickable with their
navigation methods. To prevent the anchor from taking a person to
another section of the page or another page entirely, you can do the
following:

     $('#someid').click(function(e){
                  e.preventDefault();
               //Your function
});

Also, have you heard of sprites? A sprite is multiple images wrapped
into on. In this case both the down arrow and the up arrow reside on
the same JPG. You use CSS to only show one portion (the down arrow) at
a time. When you change class then you only need to add/remove a new
class that changes the background position of that sprite. This
reduced calls to your server making your site load faster. You could
go crazy and all your images into one file. I would suggest
downloading a copy of the jquery.ui.js package that includes images
and looking at the images in the package You will see a sprite that
has all of the icons jquery.ui calls included on it.

#3. I have never had a problem required me to include what you show. I
think part of the problem is with your selector you were not specific
enough. You could save time and code by using:

j$('#navMenu div.view:first-child').fadeIn('slow');

Notice here I dropped the .find and changed the first to first-child?
The first selection of the Jqeury call is your selector and you can
get as crazy as you want here.  In your case you are looking for the
first element named div.view that follows, which may or may not be a
child. In my case I am only looking at the first child of #navMenu.

There is a lot more here: http://docs.jquery.com/Selectors

Good luck, and thanks again for helping others out.

Gregory Tarnoff
Phone: 920-Tarnoff (920-827-6633)

greg.tarn...@gmail.com
greg.tarn...@googlewave.com
www.tarnoff.info
http://www.twitter.com/gregtarnoff
http://www.flickr.com/photos/urothane

Reply via email to