ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > RocketCake
forum topic indicator Javascript to auto expand details from summary + details.
person icon
ivarforkbeard
Registered User
Quote
2025-03-27 19:55:05

So I'd like to have a small section of Summary + Details where each day of the week has different details attached to it that someone COULD click on to expand and view that day's details.

I'd also like to be able to have it automagically expand the details for whatever the current day of the week it is on the users's browser.

I changed the Element ID on each summary+details component to be something like "0day" and "1day" to represent Sunday, Monday, etc.

Then in the masterpage html I added:

<script>
const dailySpecialElement = document.getElementById(getDay() + "day");
dailySpecialElement.toggleAttribute("open");
</script>


But no go. And in fact, for some reason this prevents the details from expanding properly - they display, but on top of the text below, it no longer expands to fit them.

Any thoughts from the big brains in the group?

person icon
niko
Moderator
Quote
2025-03-28 09:50:17

With the Accordion component, this is possible. In case the id of the accordion is "elem_8538c1f", then the code for this would be this:

var elm = document.getElementById("elem_8538c1f_button");
elem_8538c1f_button_open.call(elm);



Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |