I have an element in a header. I need to expand other element on a main page when the header element is clicked. The header element only allows code in masterPage.js, so I put an onClick() action there which saves ‘open’ value in a wix storage when the element is clicked:
import { memory } from 'wix-storage';
export async function vectorImage11_click(event) {
memory.setItem("filterOpen", 'open');
}
Then I added to a main page code the part that retrieves the value from a wix storage and expands the element. When I trigger it manually with some other button on a main page it expands the element. How can I make it work itself once the header element has been clicked and “filterOpen” parameter value has changed? I gues I need to use some sort of function, but my knowledge is pretty poor so far.
import { memory } from 'wix-storage';
let filterState = memory.getItem("filterOpen");
if (filterState == 'open') {
$w('#filterStrip').expand();
}