if you have

$("#links li").hover(function(){
     var hoveredOverLI = this;
});

then "this" is a reference to the <li> item the user hovered over

so then

$("ul", this)

will select <ul> tags that are "in context" of "this" (meaning that
"this <li> is an ancestor")

$(this).find("ul") is the same selector, and in fact, the core code
converts the first selector to the second

// HANDLE: $(expr, [context])
// (which is just equivalent to: $(content).find(expr)
} else
   return jQuery( context ).find( selector );




On Dec 10, 9:36 am, mojoeJohn <mojoej...@gmail.com> wrote:
> could you explain how to read
>
> $("ul", this).slideUp("slow");
>
> the ("ul", this) has me confused. i just want to make sure i learn
> something from this instead of just copying and pasting code.
>
> thanks!
>
> On Dec 10, 9:34 am, mojoeJohn <mojoej...@gmail.com> wrote:
>
> > thanks so much it worked perfectly!!!
>
> > On Dec 10, 3:38 am, Bideshi <itbide...@gmail.com> wrote:
>
> > > Hi mojeJhon,
> > > Please try this
>
> > > -----------------------------------------------------------------
> > > <script type="text/javascript">
>
> > >         $(document).ready(function(){
> > >                 $("#links ul").hide();
> > >                         $("#links li").hover(function(){
> > >                                         $("ul", this).slideDown("slow");
> > >                                         }, function(){
> > >                                         $("ul", this).slideUp("slow");
> > >                                         } );
>
> > >                 });
> > > </script>
> > > ---------------------------------------------------------------------
>
> > > On Dec 10, 2:34 am, mojoeJohn <mojoej...@gmail.com> wrote:
>
> > > > sorry i forgot to add the ul in the sublink menus:
>
> > > > here is the correct layout:
>
> > > > <ul id="links">
> > > >       <li><a href="#">Link Head</a>
> > > >           <ul>
> > > >              <li><a href="#"></a>Sub Link</li>
> > > >              <li><a href="#"></a>Sub Link</li>
> > > >              <li><a href="#"></a>Sub Link</li>
> > > >              <li><a href="#"></a>Sub Link</li>
> > > >            </ul>
> > > >      </li>
> > > >       <li><a href="#">Link Head</a>
> > > >           <ul>
> > > >              <li><a href="#"></a>Sub Link</li>
> > > >              <li><a href="#"></a>Sub Link</li>
> > > >              <li><a href="#"></a>Sub Link</li>
> > > >              <li><a href="#"></a>Sub Link</li>
> > > >            </ul>
> > > >      </li>
> > > > </ul>

Reply via email to