[jQuery] Re: Writing a plugin

2008-11-21 Thread halcyonandon
oh wow, this was a nice comment someone left... helpful... (function($) { // Private Variables and Functions var privateVariable = {}; function privateFunction() { }; // Public Variables and Methods $.namespace = { options: {}, publicVariable: []; publicMethod: function(

[jQuery] Re: Writing a plugin

2008-11-21 Thread halcyonandon
Oh no that function was just a snippet from something working well, im not writing this for tab functionality, but rather, for a reusable widget... I'm just wondering what this function would look like converted into jQuery as a reference for everything else involved. I arbitrarily selected that

[jQuery] Re: Writing a plugin

2008-11-21 Thread Rik Lomas
I found this to be the best example of how to structure a plug-in: http://www.learningjquery.com/2007/10/a-plugin-development-pattern Rik 2008/11/21 Hector Virgen <[EMAIL PROTECTED]>: > You should take a look at jQuery's built-in tabs plugin. It may already do > what you're looking for. > http

[jQuery] Re: Writing a plugin

2008-11-21 Thread Hector Virgen
You should take a look at jQuery's built-in tabs plugin. It may already do what you're looking for. http://docs.jquery.com/UI/Tabs -Hector On Fri, Nov 21, 2008 at 1:44 PM, halcyonandon <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm new to JQuery, but I need to convert some regular, working, > java

[jQuery] Re: Writing a plugin - tips needed

2007-10-17 Thread sgrover
Let me see if I got this right. I understand private/public just fine, but am not clear on the context here... So, I'll build a sample... jQuery.myObj = function (params) { //private stuff var pad = function(num) { if (num.toString().length < 2) { return "0" + num; } return num

[jQuery] Re: Writing a plugin - tips needed

2007-10-16 Thread sgrover
So, my use of jQuery.myObject = { . . . }; seems to be correct in this case. Thanks for clarifying the extends bit. Now I think I understand the documentation. And this might come in handy - I know of a couple of plugins I might set mine to extend. I'll wait till the core stuff is stabilize

[jQuery] Re: Writing a plugin - tips needed

2007-10-16 Thread Jocko
I ran into the same question when I developed my first plug-in recently. I don't know if it's best practice, but what I found was that when you're returning a value that is not part of the chain, the method you chose worked best. Also try this: jQuery.myObj = function(params) { var privat

[jQuery] Re: Writing a plugin - tips needed

2007-10-16 Thread George GSGD
>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