Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Close canva menu when try back previous page */
- function back_button_close_menu_f() {
- echo' <script>
- const canva_menu = document.querySelector("#generate-slideout-menu");
- if (window.history && window.history.pushState){
- window.addEventListener("popstate", function(e){
- // Verify if menu is open
- if ( canva_menu.classList.contains("is-open") ){
- // close menu
- var botoes = document.querySelectorAll("button.slideout-exit");
- for (var i = 0; i < botoes.length; i++){
- botoes[i].click();
- }
- e.stopPropagation();
- }
- }, false);
- }
- </script> ';
- }
- add_action('wp_footer', 'back_button_close_menu_f');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement