Book Image

MooTools 1.2 Beginner's Guide

Book Image

MooTools 1.2 Beginner's Guide

Overview of this book

MooTools is a simple-to-use JavaScript library, ideal for people with basic JavaScript skills who want to elevate their web applications to a superior level. If you're a newcomer to MooTools looking to build dynamic, rich, and user-interactive web site applications this beginner's guide with its easy-to-follow step-by-step instructions is all you need to rapidly get to grips with MooTools.
Table of Contents (14 chapters)
MooTools 1.2 Beginner's Guide
Credits
About the Authors
About the Reviewer
Preface

Time for action—basic instantiation of the ImageCaption plugin


We will see how our plugin works under various circumstances.

  1. Create an HTML document (or modify the example we used earlier).

    <body>
    <h1>ImageCaption Script</h1>
    <p><img src="lake_mead.jpg" width="300" height="201" alt="Lake mead in a speeding car." /></p>
    <p><img src="clouds.jpg" width="150" height="101" /></p>
    <p><img src="red_rocks.jpg" width="300" height="201" title="A photo of Red Rock Mountain near Las Vegas, Nevada." /></p>
    </body>
    
  2. In the<head> section of your HTML document, reference the MooTools Core library and the ImageCaption plugin, and create a section where we will instantiate our Caption class.

    <script type="text/javascript" src="mootools.js"></script>
    <script type="text/javascript" src="ImageCaption.js"></script>
    <script type="text/javascript">
    $(window).addEvent('domready',function(){
    // Instantiate...