1

D7.18 I have a similar problem to another question but the solution did not work for me. I have added my jquery accordion file (accordion.js) to the subtheme.info file and a file called accordion.js to the subtheme folder. The accordion.js code is

(function($) {
Drupal.behaviors.accordion = {
attach: function (context, settings) {
   //code starts
  $("#accordion").accordion({
  autoHeight: false
  }
  );
   //code ends
  }
 };
 })(jQuery);

The accordion effect works correctly when logged in as admin but does not when logged out. Firebug shows for the anonymous user but none of the other classes that are shown when logged in as admin. I am using the Omega Theme. I am completely stuck as to how to resolve this

1 Answer 1

1

jQuery UI is bundled with core in D7 ( see /misc/ui ). To add jQuery Accordion JS you can just go:

e.g, in template.php

function THEMENAME_preprocess_html(&$variables) {
  drupal_add_library('system', 'ui');
  drupal_add_library('system', 'ui.accordion');
}

After that, clear all caches and check the javascript files have been added in the HTML source of the page as anon.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.