元素!如何在按下我制作的按钮几秒钟后关闭弹出窗口

发布于 2025-01-09 09:41:35 字数 27 浏览 5 评论 0原文

如何在单击空间按钮几秒钟后关闭弹出窗口?

How to close a popup after a few seconds at the click of a spacial button ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

命比纸薄 2025-01-16 09:41:35

一种可能性是延迟关闭时间,请参阅:

jQuery( document ).ready( function( $ ) {
setTimeout(
   function(){
      document.querySelector('.dialog-close-button').click();
   }, 4000);
});

可能重新发布 Close Elementor Popup with JavaScript

One possibility is to time delay close see:

jQuery( document ).ready( function( $ ) {
setTimeout(
   function(){
      document.querySelector('.dialog-close-button').click();
   }, 4000);
});

Possible repost of Close Elementor Popup with JavaScript

默嘫て 2025-01-16 09:41:35

我已经写在评论里了,我也会回复。

Elementor Pro 具有用于弹出窗口的 JS 函数。所以你可以这样称呼它
elementorProFrontend.modules.popup.closePopup( { id: yourPopupIdHere } );

总而言之:

jQuery( document ).ready( function( $ ) {
    $( document ).on( 'click', '.close-popup', function( event ) {
        setTimeout(function() { 
            elementorProFrontend.modules.popup.closePopup( {id: yourPopupIdHere}, event )} );
        }, 4000);
      });
} );

可能有一些语法错误,但它应该给你一个想法

I have written it in the comments, by I will answer as well.

Elementor Pro has JS functions for the popups. So you can call it like this
elementorProFrontend.modules.popup.closePopup( { id: yourPopupIdHere } );

All together :

jQuery( document ).ready( function( $ ) {
    $( document ).on( 'click', '.close-popup', function( event ) {
        setTimeout(function() { 
            elementorProFrontend.modules.popup.closePopup( {id: yourPopupIdHere}, event )} );
        }, 4000);
      });
} );

Might have gotten som syntax wrong, but it should give you an idea

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文