This is a helper for using Jquery Tools. It handles creating the html and javascript needed using a helper in the view.
To use the helper, in your view include
use_helper('jQueryTools');
Then call the helper
<?php echo jquerytools_overlay('#my-overlay', '<p>Hello World</p>', array{'effect'=>'apple'}) ?>
It will give the following output
<div class="apple_overlay" id="test"><p>Hello World</p></div>
<script>$(function(){$("img[rel]").overlay({"effect":"apple"});});</script>
Overlay
jquerytools_overlay(id, content, options, tag='img')
id is the unique identifier for this specific overlay. Remember you must use this id as a trigger on a different element, using rel. For example, if you overlay is called my-overlay and you triggered it off of an image, the image tag would look like <img src="my-trigger-image.png" rel="my-overlay">
content can be in the form of a partial, component, html or an external link
Options are all of the options that available to the jQueryTools overlay function and a few additional only used for the helper.
- no-javascript - if set to true, javascript is not returned
- no-html - if set to true, html is not returned
- class - additional classes for the overlay div
There is currently a bug that will not allow onBeforeLoad and other similar functions to create correctly.
The problem is with using json_encode(). It will be fixed at some point
Scrollable
jquerytools_scrollable(id, items, options)
id is the unique identifier for the scrollable items.
The items is an array of the indivual items that will be scrolled.
$item = array('<p>Hello World</p>', '<p>Hello Whirled</p>');
Options are all of the options that available to the jQueryTools scrollable function and a few additional only used for the helper.
- no-javascript - if set to true, javascript is not returned
- no-html - if set to true, html is not returned
- class - additional classes for the overlay div
There is currently a bug that will not allow onSeekTo and other similar functions to create correctly.
The problem is with using json_encode(). It will be fixed at some point
Testing is handled with the sfPhpunitPlugin