-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set all sections to be closed using collapsible instead of one remain open #14
Comments
That is the default behavior of the jQuery UI accordion. You can duplicate the template into your theme/app/mysite folder and swap out the init script to include the <script>
$( function() {
$( "#accordion" ).accordion({
collapsible: true
});
} );
</script> If you want to do a PR for adding that option as something that can be configured with the yml file, we can take a look at it. |
@korthjp17, copy this template, ElementAccordion.ss into my mysite folder? and swap out this line: to this code?
Correct? |
That should work. The template file will have to follow the same folder structure as you see in the module though. For the script, if you are leaving the template as-is for setting up the accordion, use |
@korthjp17, have tired both ways, still not working to get it collapsible. The template is actually working when i use the same folder structure, but collapsible itself it not working. Also tried to leave the template as it is, and use .accordion, does not work. I also tried to take out the accordion.init.min.js and swap for the code you've given me with #accordion, still doesn't work. |
Just pulled it down and have it working. You will likely have to create a JS file for the new init script to go in. Silverstripe is including the I created a JS file with this code and included it with the ;(function ($) {
$(document).on("ready", function () {
$( ".accordion" ).accordion({
collapsible: true
});
});
})(jQuery); |
I just did what you suggested, and it is actually working! but every time i visit the page, the first section is still open, but i can close it. Just wanted to have all closed when i visit the page, is that possible to have all closed when visiting the page? |
It looks like you can set the active option to false - http://api.jqueryui.com/accordion/#option-active |
Got it working now. Thank you so much. 👍 Here's what i added the active option to be false:
|
At the moment accordions always keep one section open, how to allow for all sections to be be collapsible? is there a way to set the collapsible set to true in the yml file?
The text was updated successfully, but these errors were encountered: