
// mobile view

const navbar = document.querySelector("[data-navbar]");
const navToggler = document.querySelector("[data-nav-toggler]");

const toggleNavbar = function () { navbar.classList.toggle("active"); }

navToggler.addEventListener("click", toggleNavbar);


// Navigation Toggle
const hamburger = document.querySelector(".hamburger");
const navList = document.querySelector(".nav-list");

hamburger.addEventListener("click", () => {
  navList.classList.toggle("open");
});

// Discount Media
const video = document.querySelector(".video");
const button = document.querySelector(".video-control");

button.addEventListener("click", playpausevideo);

function playpausevideo() {
  if (video.paused) {
    button.innerHTML = "<i class='bx bx-pause' ></i>";
    video.play();
  } else {
    button.innerHTML = "<i class='bx bx-play' ></i>";
    video.pause();
  }
}


const addEventOnElements = function (elements, eventType, callback) {
  for (let i = 0, len = elements.length; i < len; i++) {
    elements[i].addEventListener(eventType, callback);
  }
}

// Fix Nav
const navigation = document.querySelector(".navigation");
const header = document.querySelector(".header");



const preloader = document.querySelector("[data-preloader]");

window.addEventListener("load", function () {
  preloader.classList.add("loaded");
  document.body.classList.add("loaded");
});









const dataHeader = document.querySelector("[data-header]");
const backTopBtn = document.querySelector("[data-back-top-btn]");

window.addEventListener("scroll", function () {
  if (window.scrollY > 50) {
    dataHeader.classList.add("active");
    backTopBtn.classList.add("active");
  } else {
    dataHeader.classList.remove("active");
    backTopBtn.classList.remove("active");
  }
});





var typed = new Typed('#heropara', {
  // Waits 1000ms after typing "First"
  strings: ["Flexible And Risk-Free Drayage Services", "Top-Notch Customer Experience All Year Round", "Collaboration That Works "],
  stringselement:null,
  typedSpeed:10,
  startDelay:150,
  backSpeed:20,
  backDelay:1000,
  loop:true,
  loopCount:550,
  showCursor:false,
  cursorChar:null,
  attr:null,
  ContentType:"html"
});



var typed = new Typed('#typed', {
  // Waits 1000ms after typing "First"
  strings: ["Get Competitve Rate For Your Next Shipment", " Over 250+ Shippers and Brokers", "Including BNFS, JB Hunt, Coyote and Many Others..."],
  stringselement:null,
  typedSpeed:10,
  startDelay:150,
  backSpeed:20,
  backDelay:1000,
  loop:true,
  loopCount:550,
  showCursor:false,
  cursorChar:null,
  attr:null,
  ContentType:"html"
});


// Scroll Reveal

const scroll = ScrollReveal({
  distance: "100px",
  duration: 2500,
  reset: true,
});

scroll.reveal(`.content h1, .content .btn`, {
  origin: "top",
  interval: 100,
});

scroll.reveal(`.about .col h1, .about .col p, .about .col .btn`, {
  origin: "left",
  interval: 150,
});

scroll.reveal(
  `.about .col:last-child,.contact .location,.more .col:last-child,.newsletter .form`,
  {
    origin: "right",
  }
);

scroll.reveal(`.service img,.contact .title`, {
  origin: "top",
});

scroll.reveal(`.service .col,.trip .row`, {
  origin: "bottom",
});

scroll.reveal(`.trip .title,.more .col:first-child,.newsletter .col`, {
  origin: "left",
});
