1 js_example.module | js_example_accordion() |
Demonstrate accordion effect.
Related topics
File
- modules/
examples/ js_example/ js_example.module, line 111 - Hook implementations for the JavaScript Example module.
Code
function js_example_accordion() {
$title = t('Click sections to expand or collapse:');
$build['myelement'] = array(
'#theme' => 'my_accordion',
'#title' => $title,
);
$build['myelement']['#attached']['library'][] = array('system', 'ui.accordion');
$build['myelement']['#attached']['js'][] = array('data' => '(function($){$(function() { $("#accordion").accordion(); })})(jQuery);', 'type' => 'inline');
$output = backdrop_render($build);
return $output;
}