How To Trigger A Popup From A Nav Menu Item

Triggering a popup from a nav menu item is easy to do.

Create the Popup

  1. First, create your popup.
  2. In the Advanced tab of the Popup Settings, we will add a small code snippet into the Open By Selector field. For this example, we’ll enter the code shown below.
    a[href="#popup-menu-anchor"]
  3. Now publish the popup and set the Display Conditions. If the menu is in a site wide header, set the Display Conditions to Entire Site. If the menu is on a specific page, set the Display Conditions to that specific page (Singular > Pages > search and select your page).
  4. Ensure that no Triggers or Advanced Rules are set for your popup.

Note: Make sure that straight quotes are used and not curly quotes to avoid jQuery errors.

Enter code in the field shown in this image.

Edit The Menu Item

  1. Next, edit your WordPress menu located at Appearance > Menus.
  2. Add a new Custom Link
  3. In the URL, use the selector name created above ( example: #popup-menu-anchor)
  4. Enter the link text
  5. Save your menu
Add selector to custom link in menu.

That’s it! Now, when a user clicks the menu item, the popup you designed will be triggered.

Share it on social networks

Was this article helpful?

Get Started With Elementor Today

Join millions of professionals who use Elementor to build WordPress websites faster and better than ever before

On this page