On Aug 13, 2007, at 7:35 PM, Joel Birch wrote:

Personally, I'd use:

jQuery.fn.hover_menu = function(offset, speed){
this.find('<li>').each(function(){ // 'this' is already a jQuery object (the one you attach the plugin to) var current_margin = $(this).css('marginLeft'); // 'this' needs to be wrapped in a new jQuery object
   });

Shouldn't that be this.find('li') ... ? I don't think you need the < and >.

Also, to get all the li elements within the initial object, I used find() instead of children(). I'm a bit foggy on what the difference is at the moment, but find works me.

The difference is that .find() looks for all descendants (children, grandchildren, great-granchildren, etc.), while .children() looks for just, well, children. :-)



--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com


Reply via email to