简体   繁体   English

在按钮单击 Elementor 时关闭模态

[英]Close modal on button click Elementor

I hope you are having a nice day.我希望你有一个美好的一天。 I am working with the following menu:我正在使用以下菜单:

在此处输入图片说明

The site with which I am working is a Single Page, I need that when clicking any of the buttons that work as anchors to different sections (referenced by ID) they also close this popup.我正在使用的站点是一个单页,我需要在单击用作不同部分(由 ID 引用)的锚点的任何按钮时,它们也会关闭此弹出窗口。 Any idea how to do it?知道怎么做吗? I can work perfectly with JS and jQuery, I know these technologies a lot.我可以完美地使用 JS 和 jQuery,我非常了解这些技术。

Thanks for reading and giving me your time.感谢您阅读并给我您的时间。 I await your responses.我等待你的回应。 Greetings.你好。

I have this working for me:我有这个为我工作:

  • give the buttons on your popup an additional class of 'close-popup'为弹出窗口中的按钮添加一个额外的“关闭弹出窗口”类

  • add an HMTL widget to your popup with the following使用以下内容将 HMTL 小部件添加到您的弹出窗口

    <script> jQuery( document ).ready( function( $ ) { $( document ).on( 'click', '.close-popup', function( event ) { elementorProFrontend.modules.popup.closePopup( {}, event ); } ); } ); </script>

I'd like to be able to claim the credit for this, but it goes to shilo-ey我希望能够为此获得荣誉,但它归于 shilo-ey

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM