core
core copied to clipboard
Options for accordion(s).
HI everyone,
Could there be this advanced option for ce_accordion ?
- Single accordion : an option to chose if it is open or closed by default ;
- With accordion wrapper, the same open/closed option for each element inside the wrapper ;
- With accordion wrapper : an option to choose the behavior : one or many element(s) opened at a time.
Thanks.
Isn't this choice made in the JavaScript code initializing the accordion?
Yes it is... and i belive having multiple open elements in one accordion is not possible.
Regarding one element only:
Yes, but he wants this option getting set direct within the content element. Many users asked for how to set this and with an option in the CE you will not have to create a new template.
Many elements? I don't know either.
@Aybee : that's right.
For the general behavior when multiple elements, 2 ways exist :
- opening one element closes the former one,
- each element stays opened until it is manually closed.
To give you an example, here is a tuto with using only html5 and css3 : http://tympanus.net/codrops/2012/02/21/accordion-with-css3/ To make the difference, they use checkboxes (for multiple element can be open) or radio button (for only one at a time.
For e.g. MooTools accordion there are some often requested options
display: -1, // no item is open at start
alwaysHide: true, // possibility to close all items
And from MooTools more >= 1.6 (Contao 3.5.12 = 1.5.1) there will be an option to leave items open until next click on same item which closes it again. So you can leave all items open if you want to.
keepOpen: true, // MooTools More >= 1.6
http://mootools.net/more/docs/1.6.0/Fx/Fx.Accordion
But realize that every option that can be checked in a CE is another field in tl_content. So in the end I think we should leave it as it is and maybe we can put some comments into the moo_accordion template to make it easier to set the options there.
Thanks for the infos. I've just discovered "display: -1," which is what I looked for.
But realize that every option that can be checked in a CE is another field in tl_content.
I understand. But as Contao integrates accordions as core elements (all cms don't do that) it looks likes the job wasn't finished : we miss basic options…
So in the end I think we should leave it as it is and maybe we can put some comments into the moo_accordion template to make it easier to set the options there.
If think modifying model/template is Contao's way of coding specific things/behvior, not for basic options. But this won't be the worst solution with some explanations in the CE. And perhaps should the single accordion be closed by default. Accordions are made for this : hide too long informations that visitors can unhide if they want.
If you include JS plugins into the core they sometimes have 20, 50 or more options you can set. That would blow up things unnecessary I think. And if those plugins, which also are thirdparty plugins, get new options or options changes you always have to rewrite the procedure to bring the options with HTML clickedeclick into one template file from DB via PHP.
I think basic options are there. You want an accordion? Choose it and voila there it is. If you have special whishes, you can set options in a template file.
And perhaps should the single accordion be closed by default. Accordions are made for this : hide too long informations that visitors can unhide if they want.
I bet many others would argue that the first open item is an indicator that there is an accordion at all and fear that visitors may not recognize that there is hidden content if all are closed.
Ok. I understand. So, you could just add an explanation in the ce_accordion backend : "To personalise your accordion, please duplicate the model moo_... and go to http://mootools.net/more/docs/1.6.0/Fx/Fx.Accordion or duplicate js_... and go to http://...".
Then we have to give a hint "You can set more options inside the FE output template" to all those JS plugins. analytics_google, lightboxes, tablesort, choosen ...
I think so.
A hint or inside a green accordion "More options" with the text. This could be a great help if you are not a developer but a webdesigner.
Le 20 mai 2016 à 11:39, Andreas Burg [email protected] a écrit :
Then we have to give a hint "You can set more options inside the FE output template" to all those JS plugins. analyitcs_google, lightboxes, tablesort, choosen ...
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub
We could add data attributes representing the configuration options to the accordion container and evaluate them in the JavaScript.