Drupal 7 ajax command with effect
The Drupal 7 AJAX library is great, very easy to use. However, I cannot find any resources that can explain to me how to add some effects when the ajax happens. for example, when 开发者_开发问答i use ajax_command_replace to dynamically replace content with certain div, how can I make it fade in?
Thanks.
http://api.drupal.org/api/drupal/includes--ajax.inc/group/ajax/7 In the AJAX array, you can add an item "effect" and set it to slide, fade, or none (defaults to none). To make your item fade in, here's what you write:
'#ajax' => array(
'wrapper' => ...,
'callback' => ...,
'effect' => 'fade'
),
according to this link
ajax['effect']: The jQuery effect to use when placing the new HTML. Defaults to no effect. Valid options are 'none', 'slide', or 'fade'.**
For future reference, the effect goes in as a new entry in the array returned by ajax_command_*
.
For example:
$command = ajax_command_replace('#my-container', $html);
$command['effect'] = 'slide';
精彩评论