Slide effect. The class
will have five methods: __construct(), startSlide(), endSlide(), button(),
and addScript().
The way in which we use Fx.Slide requires us to add JavaScript to the window
domready event. This event is fired once the DOM (Document Object Model)
is ready. If we do not add the JavaScript in this way it is likely that we will incur
problems. This is because if important parts of the DOM are missing, such as a slider,
then the JavaScript will not be able to execute properly.
As the domready event can only trigger one event handler, we'll use the
addScript() method as a static method to build up an event handler. This will
allow us to use the Slider class to add multiple sliders without overwriting any
previous domready event handlers.
Customizing the Page
[ 272 ]
This is the Slide class:
/**
* Handles mootools Fx.Slide
*/
class Slide extends JObject
{
/**
* Slider mode: horizontal|vertical
*/
var $_mode;
/**
* Constructor
*
* @param string Slide mode: horizontal|vertical
*/
function __construct($mode = 'vertical')
{
$this->_mode = $mode;
// import mootools library
JHTML::_('behavior.
Pages:
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373