1 button, 2 functions

Hey everyone

Im trying to make an image (#headerHeart1) into a button that can be clicked to collapse and expand the header.
(Hide some elements, and show some others, and reversed)
The header is expanded as default.
Tried different things, but always got some error. Btw, Im very new to js and coding.
Can anybody spot some obvious mistake?
Here is my last attempt:

export function headerHeart1_click(event) {
if (headerStatus == 0) {
headerCollapse;
} else {
headerExpand;
}

$w.onReady(function () {
let headerStatus = 0; // 0 = header is expanded as default at website load, later 1 means header is collapsed

function headerCollapse() {
$w(“#defaultHeaderStrip, #box6, #headerMenu”).hide();
$w(“#scrollerHeaderStrip, #scrollerMenu, #scrollerLine”).show();
headerStatus = 1;
}
function headerExpand() {
$w(“#defaultHeaderStrip, #box6, #headerMenu”).show();
$w(“#scrollerHeaderStrip, #scrollerMenu, #scrollerLine”).hide();
headerStatus = 0;
}
});

Thanks
Eliakim.

Hi Eliakim,

The click function is missing a closing bracket, and your function calls should have an opened and closed parenthesis at the end of them.

export function headerHeart1_click(event) {  
    if (headerStatus == 0) {         
        headerCollapse(); 
    } else {     
        headerExpand(); 
     }
 }

Thanks so much anthonyb :+1:
That helped me get it to work😄