Created
August 20, 2021 17:14
-
-
Save pingram3541/b308a76b4a177b9da9d70a867e84b56a to your computer and use it in GitHub Desktop.
Toggle Elementor Popup + Add Body Class
This file contains 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