SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 263 | Next

Jonathan Snook, Aaron Gustafson, Stuart Langridge, and Dan Webb

"Accelerated DOM Scripting with Ajax, APIs, and Libraries"

Prototype (for which you can find downloads and full
documentation at http://prototypejs.org) is now shipped with Ruby On Rails, but it can be
(and is) regularly used on its own. Scriptaculous is commonly used with it to provide effects
and components. But because you??™ll be using only lightweight effects in this application, the
smaller and simpler Moo.fx library will be most appropriate.
Finally, because you??™ll code this feature in an unobtrusive style you??™ll need a few extra
utilities that are contained in the Low Pro (http://danwebb.net/lowpro) library, another extension
library to Prototype. Low Pro contains a whole raft of useful extensions to Prototype??™s
event handling, DOM manipulation and creation, and something that you??™ll be using heavily
in this application: behaviors.
I??™ll discuss the parts of these libraries that you need as you use them, so don??™t worry if
you??™re not familiar with them at this point??”you will be by the end of the chapter. It is, however,
a good idea to have a browser tab open with the Prototype API documentation in it (you
can find it at http://prototypejs.org/api/).
Using the Libraries in Your Project
Prototype, Low Pro, and Moo.fx are all included in the example files. To add them into your
project, open the application.rhtml layout file and add the following into the head of the
document:
<%= javascript_include_tag 'prototype', 'lowpro', 'moofx' %>
CHAPTER 9 n A DYNAMIC HELP SYSTEM 196
Or, of course, you can write the HTML directly: