0

I am using jQuery Expander Plugin v1.4.4 to format FAQ part on my website, and have a question how to hide all opened (expanded) portions of text (in my case answers) when you click on some "Read more" link. I guess it should be specified in afterExpand: opton.

Any suggestions? Thanks in advance!

1 Answers1

0

That is quite interesting problem, as there doesn't seem to be collapse method provided in the api to be called explicitly.

there would be a place for call:

  $('XYZ').expander({
    ...
    beforeExpand: function() {
    // somehow collapse everything :)
    }
});

but nothing to call :)

EDIT: OK, I think it would be theoretically possible to emulate click (in javascript) on all the expanded FAQs :) That sounds like a hack, but it could work. You just need to find those currently open, via some selector and call: .click() on them.

The way to emulate mouse in javascriptwas found here ( How can I simulate an anchor click via jquery?, as reply from Stevanicus)

Community
  • 1
  • 1
Peter Butkovic
  • 11,143
  • 10
  • 57
  • 81