最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Close modal on button click Elementor - Stack Overflow

programmeradmin2浏览0评论

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. Any idea how to do it? I can work perfectly with JS and jQuery, I know these technologies a lot.

Thanks for reading and giving me your time. I await your responses. Greetings.

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. Any idea how to do it? I can work perfectly with JS and jQuery, I know these technologies a lot.

Thanks for reading and giving me your time. I await your responses. Greetings.

Share Improve this question asked Nov 14, 2021 at 17:15 Santiago ParadeloSantiago Paradelo 932 silver badges11 bronze badges 1
  • 1 Hi and wele to stackoverflow. Sorry, but SO is not a code-writing or tutoring service. We can help solve specific, technical problems, not open-ended requests for code or advice. Please edit your question to show meta.stackoverflow./questions/260648/…, and what specific problem you need help with. See the stackoverflow./help/how-to-ask page for details on how to best help us help you. – Howard E Commented Nov 14, 2021 at 17:49
Add a ment  | 

1 Answer 1

Reset to default 5

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

    <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

发布评论

评论列表(0)

  1. 暂无评论