Simply JavaScript by Kevin Yank & Cameron Adams

Simply JavaScript by Kevin Yank & Cameron Adams

Author:Kevin Yank & Cameron Adams [Yank, Kevin]
Language: eng
Format: epub, mobi
ISBN: 9780980285802
Publisher: SitePoint Pty. Ltd.
Published: 2007-08-16T04:00:00+00:00


We can do so by passing the ID string to Effect.Highlight :

new Effect.Highlight("introduction");

As soon as you make this call, the effect will be applied to the element, as shown in Figure 5.17.

Figure 5.17. Creating a yellow fade effect with script.aculo.us

Effect.Highlight also allows you to pass it a DOM node reference, so you could apply the effect to the paragraph like this:

new Effect.Highlight(document.getElementsByTagName("p")[0]);

Most of the effects in script.aculo.us have optional parameters that allow you to customize various aspects of the effect. These parameters are specified as properties inside an object literal, which itself is passed as an argument to the effect.

For instance, by default, Effect.Highlight fades the background from yellow to white, but it’s possible to specify the start color and the end color, so we could make a particularly lurid fade from red to blue like this:

new Effect.Highlight("introduction", {startcolor: "#FF0000", endcolor: "#0000FF"});

These optional parameters will differ from effect to effect, so you’ll have to read through the script.aculo.us documentation if you wish to customize a particular effect.

Most of the effects have a duration parameter, which lets you specify how quickly you want the effect to occur. This parameter is specified in seconds, so if you wanted a two-second, lurid red-blue fade, you’d include all these parameters:

scriptaculous_highlight.js (excerpt)

new Effect.Highlight("introduction", {startcolor: "#FF0000", endcolor: "#0000FF", duration: 2});



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.