HEX
Server: Apache
System: Linux ecngx285.inmotionhosting.com 4.18.0-553.79.1.lve.el8.x86_64 #1 SMP Wed Oct 15 17:59:35 UTC 2025 x86_64
User: zeusxp5 (3862)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /home/zeusxp5/lrliberia.com/wp-content/themes/lifttruck/resources/js/screen/animation.js
(function() { 'use strict';

  // add class "wd-nav-pverlay" to navigation for overlay menu
  document.addEventListener("DOMContentLoaded", (event) => {

    ////////////////////////////////////////////////////////////////////////////////////////////////
    // add class "wd-nav-pverlay" to navigation for overlay menu if it has the class ".always-shown"
    const navOpener = document.querySelector('.wp-block-navigation__responsive-container-open.always-shown');
    if (navOpener){
      navOpener.parentElement.classList.add('wd-nav-overlay');
    }

    

    ////////////////////////////////////////////////////////////////////////////////////////////////
    // add attribute "aria-label" to Meda & text block
    const blocks = document.querySelectorAll('.wp-block-media-text__media a')
    if(blocks.length) {
      blocks.forEach( x=> x.setAttribute("aria-label","media and text"))
    }



    ////////////////////////////////////////////////////////////////////////////////////////////////
    // Select the element to which you want to add the class
    const headerPart = document.querySelector('.has-sticky-header header.wp-block-template-part');
    if (headerPart !== null) {
      // Function to add the class when scrolling
      function addClassOnScroll() {
        headerPart.classList.toggle('is-sticky', window.scrollY > 150);
        headerPart.classList.toggle('is-fixed', window.scrollY > 250);
      }
      // Event listener for scroll event
      window.addEventListener('scroll', addClassOnScroll);
  }



    ///////////////////////////////////////////////////////////////////////////////////////////////
    // Search for the ".set-transparent-header" element and add the class 'is-transparent-header' to the body
    if (document.querySelector('.set-transparent-header')) {
      document.body.classList.add('is-transparent-header');
    }



    //////////////////////////////////////// Tilt Animation ///////////////////////////////////////////////////////
    const tiltElemnts = document.querySelectorAll(".tilt");
    if( tiltElemnts !== null ){
      tiltElemnts.forEach(element => {
        element.setAttribute("data-tilt", "");
        element.setAttribute("data-tilt-speed", "500");
        element.setAttribute("data-tilt-perspective", "5000");

        VanillaTilt.init(element);
    });
    }


    
    //////////////////////////////////////// Wrap all buttons' content in a <span> tag ///////////////////////////////////////////////////////
    const buttons = document.querySelectorAll('.wp-element-button');
    buttons.forEach(button => {
      const content = button.innerHTML;
      button.innerHTML = `<span>${content}</span>`;
    });


  });

} )();