The author of glider should try using var keyword in front of it, it
is actually not referencing a local variable at all but basically the
equivalent of window.moveTo. As a further note, the function is not
anonymous but the "click" method of the Glider class.

Your solution helps because it doesn't conflict with the window.moveTo
method, but nevertheless you're polluting the global name space from
internal functions.  I've drawn up a small demo that will illustrate
what is going on.  You must use the var keyword in your function
variables.  http://positionabsolute.net/projects/javascript/global-test.html

Regards,
          Matt







On Jan 29, 8:51 am, Walter Lee Davis <[EMAIL PROTECTED]> wrote:
> I have noticed and fixed this same problem a few times now, and I
> thought I would put it out there so others don't get bitten by it.
>
> In IE6 (no SP, SP1, and SP2, as far as I can determine) if you do
> something like the following within a class (this is not my code,
> it's from Glider.js, which is a fine fine thing):
>
> ...
> click: function(event) {
>         this.stop();
>         var element = Event.findElement(event, 'a');
>         if (this.scrolling) this.scrolling.cancel();
>         moveTo = this.wrapper.down('#'+element.href.split("#")[1])
>         this.moveTo(moveTo, this.scroller, { duration:this.options.duration 
> });
>         Event.stop(event);},
>
> moveTo: function(element, container, options){
>         this.current = $(element);
>         Position.prepare();
>         var containerOffset = Position.cumulativeOffset(container),
>         elementOffset = Position.cumulativeOffset($(element));
>         this.scrolling  = new Effect.SmoothScroll(container,
>                 {duration:options.duration,
>                 x:(elementOffset[0]-containerOffset[0]),
>                 y:(elementOffset[1]-containerOffset[1])
>         });
>         return false;
>
> },
>
> ...
>
> It will work as designed in every browser except the aforementioned
> spawn of Bill. If you have a debugger installed, it will complain
> about the line that begins 'this.moveTo(moveTo ... about Object does
> not support this method.
>
> The solution, which keeps my desk rather dented, is to rename the
> item variable to something else.
>
>         myTarget = this.wrapper.down('#'+element.href.split("#")[1])
>         this.moveTo(myTarget, this.scroller,
> { duration:this.options.duration });
>
> Even though one instance of that variable is inside an anonymous
> function, and thus should be invisible to the other (and is plainly
> different than the other) IE6 can't keep the reference straight.
>
> Hope this helps someone else,
>
> Walter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to