| 1 |
const wp_bottom_menu_class = document.querySelector('.wp-bottom-menu'); |
| 2 |
const wp_bottom_menu_sfw = document.querySelector('.wp-bottom-menu-search-form-wrapper'); |
| 3 |
const wp_bottom_menu_sft = document.querySelector(".wp-bottom-menu-search-form-trigger"); |
| 4 |
const lqd_sticky = document.querySelector('.lqd-sticky-atc'); |
| 5 |
const lqd_sticky_toggle = document.querySelector('.lqd-sticky-atc-mobile-toggle'); |
| 6 |
var wpbmsf = false; |
| 7 |
|
| 8 |
if ( wp_bottom_menu_sft !== null ){ |
| 9 |
wp_bottom_menu_sft.addEventListener("click" ,function(){ |
| 10 |
wp_bottom_menu_sfw.classList.toggle("sf-active"); |
| 11 |
wp_bottom_menu_class.classList.toggle("sf-active"); |
| 12 |
if (!wpbmsf){ |
| 13 |
wp_bottom_menu_sfw.style.bottom = wp_bottom_menu_class.clientHeight + "px"; |
| 14 |
lqd_sticky_style(false); |
| 15 |
wpbmsf = true; |
| 16 |
} else { |
| 17 |
wp_bottom_menu_sfw.style.bottom = "0px"; |
| 18 |
lqd_sticky_style(true); |
| 19 |
wpbmsf = false; |
| 20 |
} |
| 21 |
}); |
| 22 |
} |
| 23 |
|
| 24 |
window.addEventListener('DOMContentLoaded', (event) => { |
| 25 |
document.body.style.paddingBottom = wp_bottom_menu_class.clientHeight + "px"; |
| 26 |
lqd_sticky_style(true); |
| 27 |
}); |
| 28 |
|
| 29 |
// Nav trigger |
| 30 |
const wp_bottom_menu_nav_wrapper = document.querySelector(".wp-bottom-menu-nav-wrapper"); |
| 31 |
const wp_bottom_menu_nav_trigger = document.querySelector(".wp-bottom-menu-nav-trigger"); |
| 32 |
const wp_bottom_menu_nav_close = document.querySelector(".wpbm-nav-close"); |
| 33 |
var wpbm_nav = false; |
| 34 |
|
| 35 |
if ( wp_bottom_menu_nav_trigger !== null ){ |
| 36 |
wp_bottom_menu_nav_trigger.addEventListener("click" ,function(){ |
| 37 |
wp_bottom_menu_nav_wrapper.classList.toggle("active"); |
| 38 |
}); |
| 39 |
} |
| 40 |
|
| 41 |
if ( wp_bottom_menu_nav_close !== null ){ |
| 42 |
wp_bottom_menu_nav_close.addEventListener("click" ,function(){ |
| 43 |
wp_bottom_menu_nav_wrapper.classList.toggle("active"); |
| 44 |
}); |
| 45 |
} |
| 46 |
|
| 47 |
// Page Back |
| 48 |
const wp_bottom_menu_page_back = document.querySelector(".wpbm-page-back"); |
| 49 |
if ( wp_bottom_menu_page_back !== null ){ |
| 50 |
wp_bottom_menu_page_back.addEventListener('click', function handleClick(event) { |
| 51 |
if ( history.length > 2 ) { |
| 52 |
history.back(); |
| 53 |
} else { |
| 54 |
window.location.href = WPBM.siteurl; |
| 55 |
} |
| 56 |
}); |
| 57 |
} |
| 58 |
|
| 59 |
function lqd_sticky_style( status ) { |
| 60 |
|
| 61 |
if ( lqd_sticky !== null ) { |
| 62 |
if ( status === true ) { |
| 63 |
lqd_sticky.style.setProperty( 'bottom', (wp_bottom_menu_class.clientHeight + lqd_sticky_toggle.clientHeight) + "px", 'important' ); |
| 64 |
lqd_sticky_toggle.style.bottom = (wp_bottom_menu_class.clientHeight + 20) + "px"; |
| 65 |
} else { |
| 66 |
lqd_sticky.style.bottom = "0px"; |
| 67 |
lqd_sticky_toggle.style.bottom = "0px"; |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
} |