Automatically Close an Elementor Popup Menu on Link Click

Automatic Elementor Pop up menu closing on clicking link

When you use an Elementor popup as a mobile menu, it often stays open after a visitor taps a link, which feels clunky. This guide adds a small script so the popup closes automatically when any link inside it is clicked, giving smoother navigation.

Need your Elementor popup menu to close automatically when someone clicks a link inside it? In this tutorial, I’ll show you exactly how I solved that problem with a simple custom script. By default, Elementor’s popups are great for mobile menus and call-to-action panels, but they can feel clunky when the popup stays open after a user chooses a menu item.

In this post, we’ll walk through the logic behind closing the popup on link click, look at the code I used, and see how you can adapt it to your own layout. You’ll learn where to place the code, how it interacts with Elementor’s popup settings, and how to make sure it works smoothly on both desktop and mobile.

Whether you’re building a fullscreen mobile menu or a small popup navigation, this quick tweak will make your site feel more polished and user-friendly — no extra plugins required.

<script>
jQuery(function($){
$(document).on(‘click’,’.elementor-location-popup a’, function(event){
elementorProFrontend.modules.popup.closePopup( {}, event);
});
});
</script>

Elementor Close PopUp on Click for Menu & Same Page Links

 

How it works

The script listens for clicks on links inside the popup and triggers the Elementor close action for that popup. Because it uses the popup id, it targets only the menu you want and leaves other popups untouched.

Tips and customization

  • Match the popup id in the code to your own popup.
  • Apply it to any menu style, not just hamburger menus.
  • Test on mobile to confirm the close feels natural.

FAQ

Does this need Elementor Pro?
Popups are a Pro feature, so you need Pro to create the popup, but the closing script itself is just JavaScript.

Will it close other popups?
No. It targets only the popup id you specify.

Leave a Reply

Your email address will not be published. Required fields are marked *

Latest tutorials

Elementor vs Bricks compared — performance, ease of use, design flexibility, ecosystem, and pricing —...
Build a smooth 3D flip card in Elementor with pure CSS — no plugin, no...
Add a glowing, moving gradient border to any Elementor container or button using pure CSS...
Freelancer Mojibur
freelancer mojibur

Start a Project!

Interested in working together? Send a quick message or schedule a meeting. Ask questions, discuss details, and decide if we are a good fit.

Website Project Inquiry

This form helps me get a general idea. We’ll schedule a meeting soon to discuss everything in more detail!

Freelancer Mojibur

Contact person

For quick communication email at: freelancermojibur@gmail.com