hey, i created a dropdown-button for a container.
I would like, that you can collapse the box after you expanded it.
Maybe someone can help me
This is my code:
$w . onReady ( function () {
$w ( '#readMoreButton' ). onClick ( () => {
$w ( '#additionalText' ). expand ();
});
});
Hi @alexkemmer98
You can add an if else statement to check wether the element is visible
then add collapse expand accordingly:
$w.onReady(function () {
$w('#readMoreButton').onClick(() => {
if ($w('#additionalText').isVisible) {
$w('#additionalText').collapse();
} else {
$w('#additionalText').expand();
}
});
});
Thank you ! i tried the if else before but something didnt work.
Rob
September 21, 2022, 7:08pm
4
@alexkemmer98
Iām not an expert by any means but I tend to use this type of code:
export function readMoreButton_click(event) {
if ($w('#additionalText').collapsed)
$w('#additionalText').expand();
else $w('#additionalText').collapse()
}
I tend to use the IDE for setting up the event: