import $ from 'jquery';
import 'jquery.easing';
import Slider from "../slider/slider";

class IHKMHSlider {
  constructor(section) {
    this.section = section.addClass('initiated');
    this.slides = section.children();
    this.slider = new Slider(section);
    this.stringLength = 0;

    this.slider.section.on('in-viewport slide-change', () => {
      const curr = this.slider.currentSlide;
      if (this.slides[curr].hasCounter) {
        this.startCounter(curr);
      }
    })
  }
}

export default IHKMHSlider;

$('body').on('ihk-init dynamic-component-loaded gfi-dynamic-init', function () {
  $('.slider:not(.initiated)').each(function() {
    new IHKMHSlider($(this));
  });
});


