Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

49 wiersze
1.3 KiB

  1. const $ = global.$;
  2. import 'jquery.easing';
  3. import Slider from "../slider/slider";
  4. class IHKMHSlider {
  5. constructor(section) {
  6. this.section = section.addClass('initiated');
  7. this.slider = new Slider(section);
  8. this.slider.settings = {
  9. loop: true,
  10. autoplay: true,
  11. infinite: true,
  12. autoplaySpeed: 700000,
  13. animationSpeed: 600,
  14. startSlide: 1,
  15. };
  16. this.section.on('slide-change', () => this.syncHeights());
  17. requestAnimationFrame(() => this.syncHeights());
  18. $(window).on('resize', () => this.syncHeights());
  19. }
  20. syncHeights() {
  21. if (!this.section.closest('.hero-fullwidth').length) return;
  22. this.section.find('.slide').each(function () {
  23. const textBox = $(this).find('.text-box');
  24. const textInImageBox = $(this).find('.text-in-image-box');
  25. if ($(window).width() > 999) {
  26. textInImageBox.height(textBox.innerHeight() - 36);
  27. } else {
  28. textInImageBox.css('height', '');
  29. }
  30. });
  31. }
  32. }
  33. export default IHKMHSlider;
  34. $('body').on('ihk-init dynamic-component-loaded gfi-dynamic-init', function () {
  35. $('.slider:not(.initiated)').each(function () {
  36. new IHKMHSlider($(this));
  37. });
  38. });