O'Reilly logo

Ajax on Rails by Scott Raymond

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11. script.aculo.us Reference

The script.aculo.us library by Thomas Fuchs (with numerous contributions from the community) is distributed in six files: scriptaculous.js, builder.js, effects.js, dragdrop.js, controls.js, and slider.js.[1] Including scriptaculous.js will automatically include the other five files, if they are in the same directory. Prototype (which script.aculo.us depends on) must be included separately.

<script src="/js/prototype.js" type="text/javascript"></script>
<script src="/js/scriptaculous.js" type="text/javascript"></script>

The standard Rails skeleton (as generated by rails myapp) includes effects.js, dragdrop.js, and controls.js in the public/javascripts directory.

From within a Rails view or layout file, the javascript_include_tag helper can be used to include external JavaScript files. By passing it :defaults, it will include Prototype, the Rails-standard script.aculo.us files, and application.js, if present:

<%= javascript_include_tag :defaults %>

Demos, downloads, and announcements are available from the official web site (http://script.aculo.us). Documentation and example code are available from the official wiki (http://wiki.script.aculo.us).

The script.aculo.us library (and this chapter) has seven major parts: visual effects, drag and drop, controls, element extensions, DOM builder, JavaScript unit testing, and miscellaneous utility methods.

Visual Effects

The Effect object encapsulates script.aculo.us’ animation effects. It defines five core effects, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required