>From what I understand, jQuery.fn objects are for functions that add
capabilites to a jQuery instance:

jQuery.fn.myFunction = function() { ... }

Would then allow you to do
$('.myItem').myFunction();

There are some things you should ensure when using this approach
(returning a jquery object for one, so you don't break the chain). The
wiki pages are quite good as a starting point 
http://docs.jquery.com/Plugins/Authoring

As far as extend goes, that's for adding additional objects to an
existing jQuery object. So if you wanted to add some more easing types
to the default jQuery.easing you could use that .

jQuery.extend( jQuery.easing, { ... });

The docs are next to useless on that one if you don't understand what
it does though http://docs.jquery.com/Utilities/jQuery.extend

HTH

George.

On Oct 16, 8:51 am, sgrover <[EMAIL PROTECTED]> wrote:
> I'm working on a jQuery plugin, which is primarily a series of utility
> functions.  I need to worry about namespace problems, so I have opted
> for the option to add an object to the base jQuery object.
>
> i.e.
>
> jQuery.myObj = { . . .  };
>
> What I'm not clear on is if this is the best approach.  Thus far
> everything is working fine, but that jQuery.fn.myObj approach and the
> jQuery.fn.extend() method are a little over my head (so far).  Are these
> better approaches to be using?
>
> The methods I'm creating return various values - ints, dates, etc.  So I
> don't think the jQuery.fn.myObj approach would work here - it would
> break chaining.
>
> So, I'm looking for any guidance you may be able to offer.  I'm the type
> that will plow through this anyways and make a choice where need be, but
> a second opinion is ALWAYS appreciated.. Just in case I'm doing things
> wrong... :)  Thanks in advance.
>
> Shawn

Reply via email to