Scriptaculous

In my ongoing Scriptaculous experimentation I can’t for the life of
me figure out how to have a div transition in on page load. I’m using
inline “display: none” to hide it initially but I want to have it
appear 5 seconds after the page loads using the BlindDown effect. No
mouseovers or clicks (which I can do), but just fire automatically.
Anyone? I’m hand-coding this one so no actions.

Todd


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

Event.observe(window,'load',function(){window.setTimeout("new Effect.BlindDown('yourdiv')",5000)});

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

Sorry, drop the new from that. Effects aren’t constructors.

Walter


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

Thanks Walter, does your example go in the Head tag or inline? I
can’t get it to work in either location. I thought everything would
get wrapped in a div like it is below, inline.

For example, when I use an onclick event it looks (and works) like this:

       <div onclick="new Effect.BlindDown(this, {duration: 2000})">
  <div id="box1">
       <p><b>Watch me drop in</b></p>
       </div>
       </div>

Todd

On Dec 8, 2007, at 7:14 PM, waltd wrote:

Event.observe(window,'load',function(){window.setTimeout 

(“Effect.BlindDown(‘box1’)”,5000)});


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

If you want something to happen at onload, you have two options. You
can either extend the body element, or you can use an unobtrusive
listener. I prefer the latter, since it’s neater and your Freeway
document isn’t riddled with extended elements that have to be dug into.

Have a look at this page for an example that makes a message box
slide down.

http://scripty.walterdavisstudio.com/onload.html

Walter

On Dec 8, 2007, at 10:29 PM, Todd wrote:

Thanks Walter, does your example go in the Head tag or inline? I
can’t get it to work in either location. I thought everything would
get wrapped in a div like it is below, inline.

For example, when I use an onclick event it looks (and works) like
this:

       <div onclick="new Effect.BlindDown(this, {duration:  

2000})">


Watch me drop in



Todd

On Dec 8, 2007, at 7:14 PM, waltd wrote:

Event.observe(window,'load',function(){window.setTimeout

(“Effect.BlindDown(‘box1’)”,5000)});


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

Thanks. I see what the problem was. I left off the forward slash “/”
from the closing script tag. You’re right, using the unobtrusive
listener is much neater, especially when I move it to an external js
file. Avoiding all the Extended windows in FW is much nicer. Besides,
I’m not allowed to use FW on a contract gig I’m trying to land, hand-
coding only.

Regarding the use of an external js file for scriptaculous effects
and such:

Assuming that the site is quite large and most pages have several
instances of scriptaculous use do you think it’s easier to manage the
effects if each page has it’s own js file or is it better to put
everything in one file? I’m curious as to how others prefer to handle
it.

Todd

On Dec 9, 2007, at 8:09 AM, Walter Lee Davis wrote:

If you want something to happen at onload, you have two options. You
can either extend the body element, or you can use an unobtrusive
listener. I prefer the latter, since it’s neater and your Freeway
document isn’t riddled with extended elements that have to be dug
into.

Have a look at this page for an example that makes a message box
slide down.

Onload


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

My own preference is to use a few large includes (which will get cached by the browser) rather than smaller page-specific includes. My feeling is that this ends up being more performant in the long run. Obviously, this would depend on how many different pages your average visitor hits in a session.

Walter


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

On 9 Dec 2007, at 17:28, waltd wrote:

My own preference is to use a few large includes (which will get
cached by the browser) rather than smaller page-specific includes.
My feeling is that this ends up being more performant in the long
run. Obviously, this would depend on how many different pages your
average visitor hits in a session.

Premature optimisation is the root of all evil. Bad programmer, no
cookie!

– Finlay


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

This could also be done in the following way:

It should go before the .

On 9 Dec 2007, at 01:14, waltd wrote:

Event.observe(window,‘load’,function(){window.setTimeout(“new
Effect.BlindDown(‘yourdiv’)”,5000)});


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

Ick. Wrap that in a function and call it from your body’s onload.

– Finlay

On 9 Dec 2007, at 22:23, Joe Billings wrote:

This could also be done in the following way:

It should go before the .

On 9 Dec 2007, at 01:14, waltd wrote:

Event.observe(window,‘load’,function(){window.setTimeout(“new
Effect.BlindDown(‘yourdiv’)”,5000)});


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


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

Or just do this one-liner in the head of your page:

 Event.observe(window,'load',function(){Effect.BlindDown 

(‘yourdiv’,{delay:5})});

Walter

On Dec 9, 2007, at 5:51 PM, Finlay Dobbie wrote:

Ick. Wrap that in a function and call it from your body’s onload.

– Finlay

On 9 Dec 2007, at 22:23, Joe Billings wrote:

This could also be done in the following way:

It should go before the .


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

This experimental page is as lean as I know how to make it, javascript-wise. If anyone sees a way to move any more js to the external file that would be great to know.

<http://anoptic.com/demo/scriptaculous/accordion.html>

Thanks for all the input.

Todd

On Dec 9, 2007, at 6:05 PM, Walter Lee Davis wrote:

Or just do this one-liner in the head of your page:

Event.observe(window,‘load’,function(){Effect.BlindDown
(‘yourdiv’,{delay:5})});

Walter

On Dec 9, 2007, at 5:51 PM, Finlay Dobbie wrote:

Ick. Wrap that in a function and call it from your body’s onload.

– Finlay

On 9 Dec 2007, at 22:23, Joe Billings wrote:

This could also be done in the following way:

It should go before the .


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

Does anyone know of a source for proper documentation of
scriptaculous, something that at least lists the available function
calls? Unless I overlooked it useful documentation on the site is
practically non-existent. I would like to have a general idea of
what’s possible with the library. Something like the MooTools or
overLib docs.

Todd


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

The Scriptaculous Wiki is hot and cold. Some functions are lavishly
explained, and others are complete mysteries. But there is a new book
out that covers both Scripty and Prototype with great detail and
quite a bit of humor. You can get the PDF version now, the print
version is still being printed or something. I ordered mine the day
it released, which coincidentally was the day that Scripty 1.8 and
Prototype 1.6 came out. The book documents the latest versions of
everything.

http://pragprog.com/titles/cppsu

Walter

On Dec 10, 2007, at 7:15 PM, Todd wrote:

Does anyone know of a source for proper documentation of
scriptaculous, something that at least lists the available function
calls? Unless I overlooked it useful documentation on the site is
practically non-existent. I would like to have a general idea of
what’s possible with the library. Something like the MooTools or
overLib docs.

Todd


dynamo mailing list
email@hidden
Update your subscriptions at:
List Options | FreewayTalk


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

Excellent timing, thanks Walter. The Scriptaculous Wiki is pretty
useless for my needs as it never seems more than luke warm at best.
I’m rather surprised given how popular the js library appears to be.

Todd

On Dec 10, 2007, at 6:56 PM, Walter Lee Davis wrote:

The Scriptaculous Wiki is hot and cold. Some functions are lavishly
explained, and others are complete mysteries. But there is a new book
out that covers both Scripty and Prototype with great detail and
quite a bit of humor. You can get the PDF version now, the print
version is still being printed or something. I ordered mine the day
it released, which coincidentally was the day that Scripty 1.8 and
Prototype 1.6 came out. The book documents the latest versions of
everything.

http://pragprog.com/titles/cppsu

Walter

On Dec 10, 2007, at 7:15 PM, Todd wrote:

Does anyone know of a source for proper documentation of
scriptaculous, something that at least lists the available function
calls? Unless I overlooked it useful documentation on the site is
practically non-existent. I would like to have a general idea of
what’s possible with the library. Something like the MooTools or
overLib docs.

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


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

I subscribe to the fire-hose of a mailing list, but it’s very hard to
keep up with. And the point you raise here is one that has been
brought up on the list time and again. Those who are in charge of the
Wiki have answered sheepishly more than once that they need to do
something better. Now that the prototypejs.org site is so amazingly
useful and usable, they have a very high bar to meet. I am sure that
someone is working on it.

Cristophe’s book is very useful in the meantime, though.

And very often I find that I am able to do most things with Prototype
alone, which makes it much easier since the documentation is so
thorough and well done. If it weren’t for the InPlaceEditor and
Ajax.Autocompleter, I don’t know how often I would crack Scripty open.

Walter

On Dec 10, 2007, at 8:04 PM, Todd wrote:

Excellent timing, thanks Walter. The Scriptaculous Wiki is pretty
useless for my needs as it never seems more than luke warm at best.
I’m rather surprised given how popular the js library appears to be.

Todd

On Dec 10, 2007, at 6:56 PM, Walter Lee Davis wrote:

The Scriptaculous Wiki is hot and cold. Some functions are lavishly
explained, and others are complete mysteries. But there is a new book
out that covers both Scripty and Prototype with great detail and
quite a bit of humor. You can get the PDF version now, the print
version is still being printed or something. I ordered mine the day
it released, which coincidentally was the day that Scripty 1.8 and
Prototype 1.6 came out. The book documents the latest versions of
everything.

http://pragprog.com/titles/cppsu

Walter

On Dec 10, 2007, at 7:15 PM, Todd wrote:

Does anyone know of a source for proper documentation of
scriptaculous, something that at least lists the available function
calls? Unless I overlooked it useful documentation on the site is
practically non-existent. I would like to have a general idea of
what’s possible with the library. Something like the MooTools or
overLib docs.

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


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

A thought: Consider using a script like this:
http://www.bobbyvandersluis.com/articles/dynamicCSS.php

This generates CSS via JS, before content is shown on a page. This follows a more accessible model of using the same mechanism to manipulate the CSS of an item both coming and going. As opposed to using ‘mandatory’/hard-coded CSS to ‘hide’ the item, and ‘optional’ scripting to ‘show’ the item.

Simplified:

CSS{hide} & JS.show() == BAD

JS.hide() & JS.show() == BETTER

Note some tweaking is needed to have the script only create one tag. Apparanetly IE has a bug that only allows for 30 tags. Each time the createStyleRule() is called, it generates a new tag.

This could also be added to a try…catch loop to even allow for errors in the scriptaculous scripting, but yet still yield a more universally accessible page.


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

Now that’s interesting. I’ll probably have to read it a half dozen
times before it starts to sink in but this is good to know. I really
appreciate it Weaver.

Todd

On Dec 11, 2007, at 1:25 PM, Weaver wrote:

A thought: Consider using a script like this:
http://www.bobbyvandersluis.com/articles/dynamicCSS.php

This generates CSS via JS, before content is shown on a page. This
follows a more accessible model of using the same mechanism to
manipulate the CSS of an item both coming and going. As opposed to
using ‘mandatory’/hard-coded CSS to ‘hide’ the item, and ‘optional’
scripting to ‘show’ the item.

Simplified:

CSS{hide} & JS.show() == BAD

JS.hide() & JS.show() == BETTER

Note some tweaking is needed to have the script only create one

tag. Apparanetly IE has a bug that only allows for 30 tags. Each time the createStyleRule() is called, it generates a new tag. This could also be added to a try...catch loop to even allow for errors in the scriptaculous scripting, but yet still yield a more universally accessible page. _______________________________________________ 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