0

could anyone suggest a way to add a spinner image to a jQuery Accordion as the accordion loads. I have tried a similar thing to how a spinner image could be added to a jQuery ui tab as seen here - replacing tabs with accordion, but that hasn't worked.

$("#accordion").accordion({
  // loading spinner
  beforeActivate: function(event, ui) {
 ui.newPanel.html('<img src="loading.gif" width="24" height="24" style="vertical-align:middle;"> Loading...');
}
});

Thanks.

Community
  • 1
  • 1
sw6 - KTBFFH
  • 207
  • 1
  • 5
  • 15
  • "but that hasn't worked" Which means??? – A. Wolff Apr 24 '14 at 14:00
  • @A.Wolff - I just edited my original post to show what I mean. The loading spinner isn't being working. – sw6 - KTBFFH Apr 24 '14 at 14:12
  • Where do you see a `beforeLoad` method for jQuery UI accordion? You should provide a jsfiddle which replicates your issue. BTW, what's wrong with solution in link you provided? – A. Wolff Apr 24 '14 at 14:17
  • Tbh there's no beforeLoad event in the jQuery ui API doc for accordion but after using beforeActivate and it breaking the accordion I decided to try the beforeLoad anyways. – sw6 - KTBFFH Apr 24 '14 at 14:44
  • `ui.panel` won't exist (when you're using `beforeActivate`). You have the option of `ui.newHeader`, `ui.newPanel`, `ui.oldHeader` or `ui.oldPanel` – Ian A Apr 25 '14 at 08:10

0 Answers0