# How can I link a button with a mega menu

**URL:** <https://forum.wixstudio.com/t/how-can-i-link-a-button-with-a-mega-menu/68189>\
**Category:** Ask the community\
**Tags:** design, wix-studio, code, question\
**Created:** [January 30, 2025, 5:26pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-button-with-a-mega-menu/68189 "2025-01-30T17:26:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brackey\_sachin](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/brackey_sachin/32/98191_2.png) [@brackey\_sachin](https://forum.wixstudio.com/u/brackey_sachin)\
**Post date:** [January 30, 2025, 5:26pm UTC](https://forum.wixstudio.com/t/how-can-i-link-a-button-with-a-mega-menu/68189/1 "2025-01-30T17:26:22Z")

</div>

![image](https://us1.discourse-cdn.com/wix/original/3X/9/3/9359630130f3aa127629b3e7ea2c7e27887fcadb.png)

Hey I got a question .I was trying to create a website and wanted to use a icon for mega menu instead of text only menu, i.e., I have a mega menu setup which opens on menu item hover. But I wanted to use a Icon instead of text.But after doing some research I found I can achieve it by Velo and tried the code I have given below.In the code I tried to link a Icon Button to a Mega menu.But it didn’t work. Note: I have also tried using Collapse & Expand instead of Show & Hide in the code.

Code:

/

```javascript
/Menu
$w.onReady(function () {
    $w('#res-btn').onClick(() => {
        $w('#dropdownMenuRes').show(); // Show the element
		console.log("Executed");
    });
});
$w.onReady(function () {
    // Show the element with a "fade" effect on button hover
    $w("#res-btn").onMouseIn(() => {
        $w("#dropdownMenuRes").show("fade", { duration: 400 });
		console.log("Executed");
    });

    // Optionally hide the element when the mouse leaves the button
    $w("#res-btn").onMouseOut(() => {
        $w("#dropdownMenuRes").hide("fade", { duration: 400 });
		console.log("Executed");
    });
});

```

The console.log(); is used to see if in actual button is clicked or not.
