I am attempting to use a button to collapse part of my home page to reveal a section, i have added the code to expand the section whilst hiding the expand button and showing the collapse button.
I have then added code to collapse the section whilst hiding the collapse button and showing the expand button. The code is as follows:
export function ExpandShape_click(event, $w) {
//Add your code for this event here:
}$w(‘#ServicesList1’).expand()
$w(‘#ExpandShape’).hide(effectName, effectOptions)
$w(‘#CollapseShape’).show(effectName, effectOptions)
export function CollapseShape_click(event, $w) {
//Add your code for this event here:
}$w(‘#ServicesList1’).collapse()
$w(‘#CollapseShape’).hide(effectName, effectOptions)
$w(‘#ExpandShape’).show(effectName, effectOptions)
Can you please tell me where I am going wrong as none of it is working. Here is a link to the home page of my website, it is regarding the “SERVICES WE OFFER” towards the bottom of the page.
export function ExpandShape_click(event, $w) {
//Add your code for this event here:
$w(‘#ServicesList1’).expand()
$w(‘#ExpandShape’).hide(“flip”, flipOptions)
$w(‘#CollapseShape’).show(“flip”, flipOptions)
}
export function CollapseShape_click(event, $w) {
//Add your code for this event here:
$w(‘#ServicesList1’).collapse()
$w(‘#ExpandShape’).show(“flip”, flipOptions)
$w(‘#CollapseShape’).hide(“flip”, flipOptions)
}
Also note hide and show return promises so you can also prevent an element showing until another finishes hiding or vice versa by embedding the dependent hide/show in a .then statement.
I just looked at your page. The collapse button is not hidden it is collapsed. You need to expand it not show it. Or you need to hide it instead of collapsing it
Then change your code so that you are showing and hiding the elements not expanding and collapsing…
So use the code as you had it before based on olesiaz suggestion:
export function ExpandShape_click(event, $w) {
//Add your code for this event here:
$w('#ServicesList1').expand()
$w('#ExpandShape').hide("flip", flipOptions)
$w('#CollapseShape').show("flip", flipOptions)
}
export function CollapseShape_click(event, $w) {
//Add your code for this event here:
$w('#ServicesList1').collapse()
$w('#ExpandShape').show("flip", flipOptions)
$w('#CollapseShape').hide("flip", flipOptions)
}