Scripty Menu

This is a follow-up from a previous example I was working on at <http://anoptic.com/demo/scriptaculous/menu/index.html>. All I need to do is move the scripty stuff out of the html and put it in an external file. Here’s the js that will go in the file <http://pastie.caboo.se/153804> which I can’t get to work.

BTW, I’ve removed the external file and placed the js back into the page so you can see how the effects should be working.

Todd

That’s a nice effect. The end result is similar to that which Joe Billings assisted me with employing a Rollover trigger and slave layer. That one is currently limited to fade although I imagine it could include slide down at some later stage. I ended up with this in the page

http://www.petemackenzie.co.uk/desgallpage.html

Pete

On 18 Feb 2008, at 18:28, Todd wrote:

This is a follow-up from a previous example I was working on at <http://anoptic.com/demo/scriptaculous/menu/index.html>. All I need to do is move the scripty stuff out of the html and put it in an external file. Here’s the js that will go in the file <http://pastie.caboo.se/153804> which I can’t get to work.

BTW, I’ve removed the external file and placed the js back into the page so you can see how the effects should be working.

Todd


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I fear I may have led you astray with the previous code. Here’s a
corrected version. There were some frank syntax errors (lots of
missing parentheses and braces and an extra semicolon or two) but
there was also a fundamental logical error. If you are setting up a
variable in a loop, and applying it to an anonymous function, the
only value you will end up setting is the last one in the loop.
That’s because the loop has finished long before the function is ever
called, and the only value that the anonymous function receives is
whatever value that variable is set to when it is called. That’s
the beauty (and peril) of anonymous functions. They don’t exist until
you call them.

Compare and contrast:

http://pastie.caboo.se/153852

Walter

On Feb 18, 2008, at 1:28 PM, Todd wrote:

This is a follow-up from a previous example I was working on at
http://anoptic.com/demo/scriptaculous/menu/index.html. All I need
to do is move the scripty stuff out of the html and put it in an
external file. Here’s the js that will go in the file <http://
pastie.caboo.se/153804> which I can’t get to work.

BTW, I’ve removed the external file and placed the js back into the
page so you can see how the effects should be working.

Todd


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Perfect. Thanks Walter.

I was pouring over the Prototype/Scripty docs trying to determine what I was doing wrong. Fortunately I was able to set up a listener for each element (which was good) but I liked your compact approach better although I was unable to figure out what the problem was…until now.

Cool beans.

Todd

On Feb 18, 2008, at 1:54 PM, Walter Lee Davis wrote:

I fear I may have led you astray with the previous code. Here’s a

corrected version. There were some frank syntax errors (lots of

missing parentheses and braces and an extra semicolon or two) but

there was also a fundamental logical error. If you are setting up a

variable in a loop, and applying it to an anonymous function, the

only value you will end up setting is the last one in the loop.

That’s because the loop has finished long before the function is ever

called, and the only value that the anonymous function receives is

whatever value that variable is set to when it is called. That’s

the beauty (and peril) of anonymous functions. They don’t exist until

you call them.

Compare and contrast:

http://pastie.caboo.se/153852

Hi Pete,

Yep, they are similar. I’ll have to try what you did except use FW this time. Thanks for the link.

Todd

On Feb 18, 2008, at 1:27 PM, Pete MacKenzie wrote:

That’s a nice effect. The end result is similar to that which Joe Billings assisted me with employing a Rollover trigger and slave layer. That one is currently limited to fade although I imagine it could include slide down at some later stage. I ended up with this in the page

http://www.petemackenzie.co.uk/desgallpage.html

Bear in mind that I am very much an end-user. From watching and tinkering at the roadside while you guys mess about under the hood I’m beginning to understand what is actually there under the hood, but I reckon I’m basically a driver not an engineer. Although I’ve exploited an effect I am much in admiration of those who can script it from scratch.

Pete

Seeing as this forum is called Dynamo what era of engine do you think it’s running in now, the Model T Ford? Later…? And what sort of effects will people be using when we get to the Lexus stage?

On 18 Feb 2008, at 21:13, Todd wrote:

Hi Pete,

Yep, they are similar. I’ll have to try what you did except use FW this time. Thanks for the link.

Todd

On Feb 18, 2008, at 1:27 PM, Pete MacKenzie wrote:

That’s a nice effect. The end result is similar to that which Joe Billings assisted me with employing a Rollover trigger and slave layer. That one is currently limited to fade although I imagine it could include slide down at some later stage. I ended up with this in the page

http://www.petemackenzie.co.uk/desgallpage.html


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Cheers
Pete

Be careful Pete, watching and tinkering on the side is how it starts! ; ) Before you know you’ll be knee-deep in it for real. Thankfully there are code-savvy people 'round these parts who are willing to assist those of us who have a desire to understand how and why something works the way it does. My personal thanks to Cats like Walter, Weaver, Keith, Ernie and many others who either directly or indirectly continually stoke the fires of my understanding, however slow I may be at times.

Todd

On Feb 18, 2008, at 5:03 PM, Pete MacKenzie wrote:

Bear in mind that I am very much an end-user. From watching and tinkering at the roadside while you guys mess about under the hood I’m beginning to understand what is actually there under the hood, but I reckon I’m basically a driver not an engineer.