Visual effect

From PHP on Trax

Jump to: navigation, search

visual_effect( string $name, string $element_id = null, array $js_options = array() )

Description

Returns a Javascript snippet to be used on the AJAX callbacks for starting visual effects.

This method requires the inclusion of the script.aculo.us Javascript library.

$name a string which is the name of the visual effect.

$element_id a string which is what element to perform effect on.

$js_options is an array of key => value pairs of options for scriptaculous visual effect ($name).

If no element_id is given, it assumes "element" which should be a local variable in the generated Javascript execution context. This can be used for example with link_to_remote:

This would fade the element that was delete by clicking the link_to_remote link.

You can change the behaviour with various options, see http://script.aculo.us for more documentation.

Examples



<?= link_to_remote("Delete Me", array(
                   
"url" => array(":action" => "ajax_delete"),
                   
"update" => "some_div",
                   
"complete" => visual_effect("fade""some_div"))) ?>
Personal tools