I’m trying to change the color of the hamburger menu icon in a mobile view using Velo in Wix. However, when I attempt to set the color using the following code:
$w.onReady(function () {
$w("#menuToggle1").style.color = "red";
});
I receive the error: Property ‘style’ does not exist on type ‘HiddenCollapsedElement’.
I understand that the style property is not applicable here. What is the correct way to change the icon color of the menuToggle component programmatically? Any guidance or examples would be greatly appreciated!
2
Answers
Try using the
setStyle
method as follows:It doesn’t look like menu elements have a style property or have CSS support in Wix. So you can’t actually change the color of the element at runtime. As a workaround, you can duplicate your menu, change the color in the editor on the duplicate, and hide/show the menus accordingly.