I am using Drupal 7 and trying to add the jquery ui effect highlight. I successfully added the accordion widget to my page but cannot find any proper documentation for adding effects. I put the PHP directly into my body HTML. Could someone please give me some help? I am really new at Jquery and Drupal.

drupal_add_library('system', 'effects.highlight');
drupal_add_library('system', 'ui.accordion');
drupal_add_js('jQuery(document).ready(function(){jQuery("#accordion").accordion();});', 'inline');
drupal_add_js('jQuery(document).ready(function(){jQuery("#highlight").highlight();});', 'inline');
$(function() { $("highlight").click(function () { $(this).effect("highlight", {}, 3000); }); $( "#accordion" ).accordion({ active: false, autoHeight: false, navigation: true, collapsible: true, create: function(event, ui) { $("#accordion").show(); } }); });

Comments

JFKiwad’s picture

Try to put your drupal_add_library functions on top of page.tpl.php (inside your theme)

ibit’s picture

My solution:
1) Input drupal_add_library('system', 'effects.highlight'); to your theme template.php file.
2) Input your jQuery code to some js file (ex. /sites/all/themes/YOURTHEME/js/script.js).
3) Add this file in the YOURTHME.info file as scripts[] = js/script.js

And don't forget flush cashes. I'ts work very well.