[jQuery] Re: Plugin developement

2008-09-05 Thread mwk
Another "solution" i found on a Blog. Instead of adding a function to the Plugin, create a seperate object within the scope of the plugin. ;(function($) { $.fn.pluginname = function(options) { // private method function _doSomethingPrivate() {

[jQuery] Re: Plugin developement

2008-09-03 Thread mwk
Hi, Wow, thanks to both of you. Wouldn't have thought about such an construct. Maybe because i'm not that familiar with javascript at all. Somehow i thought you can't access an object while creating it. But also the way Balazs was mentioning about jmap looks interesting. I will have a closer look

[jQuery] Re: Plugin developement

2008-09-03 Thread Balazs Endresz
It depends on what the public method returns. If it returns the jQuery object (the 'this' inside the plugin) then you have to call $ ('#example').pluginname.doSomethingPublic().pluginname.doSomethingElse(). If you want to chain your methods directly you have to return 'this' inside your public me

[jQuery] Re: Plugin developement

2008-09-02 Thread Mike Alsup
> i have a problem with the understanding of public methods of an > plugin. Specialy how to create and link them to the plugin. > > For example: > > ;(function($) > { >         $.fn.pluginname = function(options) >         { >                 var _options = $.extend( >                 { >        

[jQuery] Re: Plugin developement

2008-09-02 Thread Balazs Endresz
If you declare the public method inside $.fn.pluginname then it will be able to access the private things too, but this way the public function won't be declared just after $().pluginname() was called. So you can't call $.fn.pluginname.doSomethingPublic() before that. But you can get around this

[jQuery] Re: Plugin developement

2008-09-02 Thread mwk
Is there realy nobody out there, who can point me into the right direction? A link to a tutorial would be already great. If somebody doesn't understand the question, please tell me, i will try to explain it further.