The script.aculo.us
library is an add-on for Prototype that contains several user interface enhancements such as animation, drag-and-drop and AJAX controls. In this recipe, we will set up script.aculo.us
and add a shake
animation effect to verify it has loaded correctly.
First, we need to obtain a copy of script.aculo.us
by visiting http://script.aculo.us/, and navigating to the download page. Download the ZIP archive of the current version, and unzip it into a folder named scriptaculous
inside the cook
subdirectory of the Moodle installation used in this example, that is, /path/to/moodle/cook/scriptaculous
.
Create a PHP file, external_scriptaculous.php
, with the following content:
<?php require_once(dirname(__FILE__) . '/../config.php'); $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM)); $PAGE->set_url('/cook/external_scriptaculous.php'); $PAGE->requires->js('/cook/prototype.js'); $PAGE->...