2158

Dynamically Opening and Closing Popups

If you are a developer and want to want to Open your Created Popups with Javascript on certain user action like form submission, click, hover or on an event, you can easily do so with just one line of code.

To Open Your Popup:

brave_open_popup(123);

To Close Your Popup:

brave_close_popup(123);

Here 123 is the ID of your Popup. To know the popup’s id, go to the Popups List and click the Popup to enter the editor and it will display at the end of your browser address bar. Like so:  http://mywebsite.com/wp-admin/admin.php?page=bravepop&id=123

 

Examples

Let’s say you want to open a Popup you created that includes a custom thank you message, and want to display it when a visitor submits a form. You can call the Popup like this:

document.getElementById('myformID').addEventListener('submit', brave_open_popup(123));

 

Another example could be that, you want to display small info popup like tooltip that you created and only want to show/hide it when the visitor hovers over certain elements with a specific css class. You can use the javascript mouseover event to perform this:

document.getElementsByClassName('my_hover_element')("mouseover", brave_open_popup(123));
document.getElementsByClassName('my_hover_element')("onmouseout", brave_open_popup(123));