Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you trigger Elementor Popup via code

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

function popup_call(){
    ...
    if(....){
        //trigger the popup here...
    } 
}
like image 590
Polar Avatar asked Jun 03 '26 14:06

Polar


1 Answers

This question has already been answered:

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

https://github.com/elementor/elementor/issues/7077#issuecomment-595570337

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;
}

and use click with js (jquery)

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

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

like image 163
Unbywyd Avatar answered Jun 06 '26 05:06

Unbywyd