// const ready = require('./utils/documentReady.js');

// ready(function(){
//   console.log('DOM героически построен!');
// });

// const $ = require('jquery');
// $( document ).ready(function() {});

/* eslint-disable */

import $ from "jquery";

import "slick-carousel/slick/slick.min.js";

$(".inner-carousel").slick({
  infinite: false,
  arrows: true,
  dots: true,
  slidesToShow: 1,
  slidesToScroll: 1,
});

$(".banners-row-field").slick({
  infinite: false,
  arrows: false,
  dots: true,
  slidesToShow: 4,
  slidesToScroll: 4,
});

class Application {
  init() {
    this.turnParallax();
  }

  turnParallax() {
    const parallaxItems = document.querySelectorAll("[parallax]");
    const windowHeight = window.pageYOffset;

    if (parallaxItems) {
      window.addEventListener("scroll", () => {
        parallaxItems.forEach((item) => {
          const currentOffset = item.getBoundingClientRect().y;
          const currentSpeed = item.getAttribute("parallax");

          if (currentOffset < windowHeight) {
            item.style.transform = `translateY(${
              currentOffset / currentSpeed
            }px)`;
          }
        });
      });
    }
  }
}

const radon = new Application();

radon.init();
