如何通过代码触发Elementor Popup

编程入门 行业动态 更新时间:2024-10-08 20:35:21
本文介绍了如何通过代码触发Elementor Popup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这里有人使用 Elementor 吗?您如何通过代码触发弹出窗口?例如.

is anybody here using Elementor? How do you trigger the Popup via code? For example.

function popup_call(){ ... if(....){ //trigger the popup here... } }

推荐答案

此问题已得到答案:

// accessible on window.elementorProFrontend elementorProFrontend.modules.popup.showPopup( { id: 123 } );

github/elementor/elementor/issues/7077#issuecomment-595570337

或尝试将弹出窗口绑定到按钮,使用CSS隐藏该按钮

or try to bind your popup to a button, hide the button with css

.yourbtn { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

并在js中使用click(jquery)

and use click with js (jquery)

$('.yourbtn').click();

如果第二种方法对您有帮助,请不要忘记在屏幕阅读器中隐藏按钮aria-hidden ="true"和tabindex =-1"

If the second method helps you, do not forget to hide the button from screen readers aria-hidden="true" and tabindex="-1"

更多推荐

如何通过代码触发Elementor Popup

本文发布于:2023-08-03 06:36:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1284917.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   Elementor   Popup

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!