Alexandre is already using a closure to extend jQuery with the plugin.

Alexandre, try to convert the timeout property from privileged to
private ("this.timeout" to "var timeout") and its accessors, then
check back here... the problem is: if you use privileged members
inside the plugin main function, "this" resolves to the jQuery element
wrapper, so "this.timeout" will clash with other members if already
setted.

Hope this helps,

Diogo Baeder



On Apr 12, 9:06 pm, Julian Aubourg <[email protected]> wrote:
> A usual technique for having variables local to a plugin is to use function
> scoping like this:
> (function($) {
>
>   var firstVar = ...;
>   var secondVar = ...;
>
>   $.pluginFunction = function() {
>     ...
>   };
>
> })(jQuery);
>
> 2009/4/12 Alexandre Marinho <[email protected]>
>
>
>
> > Hi, i'm tring to reproduce a library of mine from Prototype to JQuery.
> > It's a script to animate images in a container with a few effects...
> > but I'm having some troubles with plugin local variables.
>
> > The thing is that is working only when there is one container, with
> > more than one the variables are mixed specially the timeout. That
> > doesn't happen with Prototype because it uses OO pattern which makes
> > things a lot easier.
>
> > Here is my code:http://dpaste.com/32327/
>
> > I've spent the last two days trying to do that. Is there a better way
> > to do that?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to