-
-
Save dexit/9ab50e450f8bd85579b5c28c28508538 to your computer and use it in GitHub Desktop.
Toggle Elementor Popup + Add Body Class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var nav = false; | |
| const menu_close = () => { | |
| //elementorProFrontend.modules.popup.closePopup( { id: 191 } ); | |
| elementorFrontend.documentsManager.documents[191].getModal().hide(); | |
| nav = false; | |
| //console.log('menu closed!'); | |
| } | |
| const menu_open = () => { | |
| //elementorProFrontend.modules.popup.showPopup( { id: 191 } ); | |
| elementorFrontend.documentsManager.documents[191].showModal(); | |
| nav = true; | |
| //console.log('menu opened!'); | |
| } | |
| const menu_handler = (e) => { | |
| document.body.classList.toggle('menu_open'); | |
| nav ? menu_close() : menu_open(); | |
| } | |
| const menu_btn = document.getElementById('menu_button'); | |
| menu_btn.addEventListener('click', menu_handler); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment