本文介绍了如何通过代码触发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
发布评论