custom/plugins/NenoHeroSlider/src/Resources/views/storefront/include/neno-hero-slider.html.twig line 1

Open in your IDE?
  1. {% block neno_hero_slider %}
  2.     {% set config = config('NenoHeroSlider.config') %}
  3.     {% if config.isSliderActive %}
  4.         {% if page.extensions.hero_slider_slides %}
  5.             {% set slides = page.extensions.hero_slider_slides.elements %}
  6.             {% if slides|length > 0 %}
  7.                 {% set validMediaIds = [
  8.                     config.leftArrowIconGraphic,
  9.                     config.rightArrowIconGraphic,
  10.                     config.scrollIndicatorIconGraphic,
  11.                 ]|filter(id => id is not null) %}
  12.                 {% set customMediaCollection = searchMedia(validMediaIds, context.context) %}
  13.                 {% set customLeftArrowGraphic = customMediaCollection.get(config.leftArrowIconGraphic) %}
  14.                 {% set customRightArrowGraphic = customMediaCollection.get(config.rightArrowIconGraphic) %}
  15.                 {% set customScrollIndicatorGraphic = customMediaCollection.get(config.scrollIndicatorIconGraphic) %}
  16.                 {% set controlsDisabled = config.oneSlideControlsDisabled ? (slides|length < 2) : false %}
  17.                 {% set aspectRatioLandscape = (
  18.                     config.aspectRatioWidth and config.aspectRatioHeight and config.aspectRatioHeight is not same as(0)
  19.                     ? (config.aspectRatioWidth / config.aspectRatioHeight)
  20.                     : 2
  21.                     ) %}
  22.                 {% set aspectRatioPortrait = (
  23.                     config.inheritAspectRatioForPortrait
  24.                     ? aspectRatioLandscape
  25.                     : (
  26.                     config.aspectRatioWidthPortrait and config.aspectRatioHeightPortrait and config.aspectRatioHeightPortrait is not same as(0)
  27.                     ? (config.aspectRatioWidthPortrait / config.aspectRatioHeightPortrait)
  28.                     : 0.6
  29.                     )
  30.                     ) %}
  31.                 {% set heroSliderUserConfig = {
  32.                     heightScaleMode: config.heightScaleMode,
  33.                     heightScaleModePortrait: config.heightScaleModePortrait is same as('inherit') ? config.heightScaleMode : config.heightScaleModePortrait,
  34.                     forceLoadPortraitWhenDeviceIsPortrait: config.forceLoadPortraitImagesOnPortraitDevices ? true : false,
  35.                     forceLoadLandscapeWhenDeviceIsLandscape: config.forceLoadLandscapeImagesOnLandscapeDevices ? true : false,
  36.                     transitionMode: config.transitionMode ?: 'slide',
  37.                     aspectRatio: aspectRatioLandscape,
  38.                     aspectRatioPortrait: aspectRatioPortrait,
  39.                     useInterval: config.useInterval and not controlsDisabled ? true : false,
  40.                     boundaryMode: config.boundaryMode ?: 'infinite',
  41.                     infiniteWrapMode: config.infiniteWrapMode ?: 'loop',
  42.                     transitionDuration: config.transitionDuration ?: 1,
  43.                     transitionEasingCurve: config.easingCurve ?: 'EASE',
  44.                     interval: config.intervalDuration ? (config.intervalDuration * 1000) : 12000,
  45.                     fadeScrollIndicatorOnScroll: config.animateScrollIndicator ? true : false,
  46.                     scrollOnScrollIndicatorClick: config.scrollOnScrollIndicatorClick ? true : false,
  47.                     enableArrowKeyControl: config.enableArrowKeyControl and not controlsDisabled ? true : false,
  48.                     touchDragEnabled: config.enableTouchSwiping ? true : false,
  49.                     mouseDragEnabled: config.enableMouseSwiping ? true : false,
  50.                 } %}
  51.                 <div
  52.                     class="hero-slider{% if config.transitionMode is same as('slide') %} hero-slider-mode-slide{% else %} hero-slider-mode-blend{% endif %}{% block neno_hero_slider_class_append %}{% endblock %}"
  53.                     id="hero-slider"
  54.                     data-hero-slider
  55.                     data-hero-slider-options='{% block neno_hero_slider_json_config %}{{ heroSliderUserConfig|json_encode }}{% endblock %}'
  56.                 >
  57.                     {% block neno_hero_slider_inner %}
  58.                     <noscript>
  59.                         {% block neno_hero_slider_noscript_styles %}
  60.                         <style>
  61.                             .hero-slider {
  62.                                 overflow: auto; !important;
  63.                             }
  64.                             .hero-slider,
  65.                             .hero-slider-slide-container {
  66.                                 height: 60vh !important;
  67.                             }
  68.                             .hero-slider-image {
  69.                                 width: 100% !important;
  70.                                 height: auto !important;
  71.                             }
  72.                             .hero-slider {
  73.                                 position: relative !important;
  74.                             }
  75.                             .hero-slider-image {
  76.                                 position: static !important;
  77.                             }
  78.                             .hero-slider-scroll-overlay,
  79.                             .hero-slider-navigation-btn,
  80.                             .hero-slider-menu {
  81.                                 display: none;
  82.                             }
  83.                         </style>
  84.                         {% endblock %}
  85.                     </noscript>
  86.                     <div class="hero-slider-slide-container">
  87.                         {% apply spaceless %}
  88.                         {% for slide in slides %}
  89.                         {% if slide.mediaLandscape %}
  90.                             {% set alt_title_landscape = slide.translated.imageAltTitle ?: slide.mediaLandscape.alt %}
  91.                             {% set landscape_thumbnails = slide.mediaLandscape.thumbnails|sort|reverse|json_encode %}
  92.                         {% endif %}
  93.                         {% if slide.mediaPortrait %}
  94.                             {% set alt_title_portrait = slide.translated.imageAltTitle ?: slide.mediaLandscape.alt %}
  95.                             {% set portrait_thumbnails = slide.mediaPortrait.thumbnails|sort|reverse|json_encode %}
  96.                         {% endif %}
  97.                         <div
  98.                             class="hero-slider-slide{% if slide.cssClass %} {{ slide.cssClass|sw_sanitize }}{% endif %}"
  99.                             data-animation-duration="{% block neno_hero_slider_image_anim_duration %}60{% endblock %}"
  100.                             data-animation-preset-landscape="{{ slide.imageMovementPresetLandscape ?: 'NONE' }}"
  101.                             data-animation-preset-portrait="{{ slide.imageMovementPresetPortrait ?: 'NONE' }}"
  102.                             style="background-color: {{ slide.backgroundColor ?: 'transparent' }}"
  103.                         >
  104.                             {% block neno_hero_slider_slide_inner %}
  105.                             {% block neno_hero_slider_slide_image %}
  106.                             {% if slide.mediaLandscape or slide.mediaPortrait %}
  107.                                 <img
  108.                                     class="hero-slider-image"
  109.                                     alt="{{ slide.translated.imageAltTitle ?: (slide.mediaLandscape.alt ?: slide.mediaPortrait.alt) }}"
  110.                                     {% apply spaceless %}
  111.                                         {% if slide.mediaPortrait %}
  112.                                             {% block neno_hero_slider_slide_portrait_srcset %}
  113.                                                 {% if slide.mediaPortrait.thumbnails|length > 0 %}
  114.                                                     {% set thumbnails = slide.mediaPortrait.thumbnails|sort|reverse %}
  115.                                                     {# generate srcset with all available thumbnails #}
  116.                                                     {% set srcsetValue %}{% apply spaceless %}
  117.                                                         {{ slide.mediaPortrait|sw_encode_media_url }} {{ thumbnails|first.width + 1 }}w, {% for thumbnail in thumbnails %}{{ thumbnail.url | sw_encode_url }} {{ thumbnail.width }}w{% if not loop.last %}, {% endif %}{% endfor %}
  118.                                                     {% endapply %}{% endset %}
  119.                                                     data-srcset-portrait="{{ srcsetValue }}"
  120.                                                 {% endif %}
  121.                                                 data-src-portrait="{{ slide.mediaPortrait|sw_encode_media_url }}"
  122.                                             {% endblock %}
  123.                                         {% endif %}
  124.                                         {% if slide.mediaLandscape %}
  125.                                             {% block neno_hero_slider_slide_landscape_srcset %}
  126.                                                 {% if slide.mediaLandscape.thumbnails|length > 0 %}
  127.                                                     {% set thumbnails = slide.mediaLandscape.thumbnails|sort|reverse %}
  128.                                                     {# generate srcset with all available thumbnails #}
  129.                                                     {% set srcsetValue %}{% apply spaceless %}
  130.                                                         {{ slide.mediaLandscape|sw_encode_media_url }} {{ thumbnails|first.width + 1 }}w, {% for thumbnail in thumbnails %}{{ thumbnail.url | sw_encode_url }} {{ thumbnail.width }}w{% if not loop.last %}, {% endif %}{% endfor %}
  131.                                                     {% endapply %}{% endset %}
  132.                                                     data-srcset-landscape="{{ srcsetValue }}"
  133.                                                 {% endif %}
  134.                                                 data-src-landscape="{{ slide.mediaLandscape|sw_encode_media_url }}"
  135.                                             {% endblock %}
  136.                                         {% endif %}
  137.                                     {% endapply %}
  138.                                     sizes="100vw"
  139.                                 >
  140.                                 <noscript>
  141.                                     {% if slide.mediaLandscape %}
  142.                                         {% sw_thumbnails 'hero-slider-thumbnails-landscape' with {
  143.                                             media: slide.mediaLandscape,
  144.                                             attributes: {
  145.                                                 alt: alt_title_landscape,
  146.                                                 class: 'hero-slider-thumbnails hero-slider-thumbnails-landscape'
  147.                                             }
  148.                                         } %}
  149.                                     {% endif %}
  150.                                     {% if slide.mediaPortrait %}
  151.                                         {% sw_thumbnails 'hero-slider-thumbnails-portrait' with {
  152.                                             media: slide.mediaPortrait,
  153.                                             attributes: {
  154.                                                 alt: alt_title_portrait,
  155.                                                 class: 'hero-slider-thumbnails hero-slider-thumbnails-portrait'
  156.                                             }
  157.                                         } %}
  158.                                     {% endif %}
  159.                                 </noscript>
  160.                                 </img>
  161.                             {% endif %}
  162.                             {% endblock %}
  163.                             {% block neno_hero_slider_slide_overlay %}
  164.                             <div class="hero-slider-overlay" role="presentation" style="background-color: {{ slide.overlayColor ?: (config.defaultOverlayColor ?: 'transparent') }}"></div>
  165.                             {% endblock %}
  166.                             {% block neno_hero_slider_slide_link %}
  167.                             {% if slide.translated.slideLink %}
  168.                             <a class="hero-slider-slide-link" href="{{ slide.translated.slideLink }}" title="{{ slide.translated.buttonLinkText ?: ('neno-hero-slider.openLink'|trans) }}" {% if slide.slideLinkNewTab %} target="_blank" rel="noopener"{% endif %} draggable="false"></a>
  169.                             {% endif %}
  170.                             {% endblock %}
  171.                             {% block neno_hero_slider_slide_content %}
  172.                             <div class="hero-slider-content-container hs-vertical-align-{{ config.verticalTextBlockAlignment ?: 'center' }} hs-horizontal-align-{{ config.horizontalTextBlockAlignment ?: 'left' }}">
  173.                                 {% block neno_hero_slider_slide_content_inner %}
  174.                                 {% if slide.translated.textContentBeforeHeadline or slide.translated.headline or slide.translated.textContentAfterHeadline or slide.translated.buttonLink %}
  175.                                 <div class="hero-slider-description hs-t-align-{{ config.defaultTextAlignment ?: 'left' }}" style="background-color: {{ config.textBlockBackgroundColor ?: 'transparent' }}; color: {{ config.defaultTextBlockColor ?: 'white' }}">
  176.                                     {% block neno_hero_slider_slide_description_inner %}
  177.                                     {% block neno_hero_slider_slide_content_before %}
  178.                                     <div class="hero-slider-content-before">
  179.                                         {% block neno_hero_slider_slide_content_before_inner %}
  180.                                         {{ ((slide.translated.textContentBeforeHeadline|raw) ?: '')|sw_sanitize }}
  181.                                         {% endblock %}
  182.                                     </div>
  183.                                     {% endblock %}
  184.                                     {% set headline_tag_name = (loop.first ? (config.headlineTagNameFirstSlide ?: 'h2') : ((config.headlineTagNameFollowingSlides ?: 'h2'))) %}
  185.                                     {% block neno_hero_slider_slide_headline %}
  186.                                     {% set headline_html %}<{{ headline_tag_name }} class="hero-slider-headline">{{ ((slide.translated.headline|raw) ?: '')|sw_sanitize }}{{ '</'|raw }}{{ headline_tag_name }}>{% endset %}
  187.                                     {{ headline_html }}
  188.                                     {% endblock %}
  189.                                     {% block neno_hero_slider_slide_content_after %}
  190.                                     <div class="hero-slider-content-after">
  191.                                         {% block neno_hero_slider_slide_content_after_inner %}
  192.                                         {{ ((slide.translated.textContentAfterHeadline|raw) ?: '')|sw_sanitize }}
  193.                                         {% endblock %}
  194.                                     </div>
  195.                                     {% endblock %}
  196.                                     {% block neno_hero_slider_slide_cta_container %}
  197.                                     <div class="hero-slider-cta-container hs-t-align-{{ config.ctaButtonAlignment ?: 'left' }}">
  198.                                         {% block neno_hero_slider_slide_cta_container_inner %}
  199.                                         {% if slide.translated.buttonLink %}
  200.                                         <a class="btn btn-{{ config.ctaButtonType ?: 'primary' }} hero-slider-cta-btn" title="{{ slide.translated.buttonLinkText }}" tabindex="-1" href="{{ slide.translated.buttonLink }}"{% if slide.buttonLinkNewTab %} target="_blank" rel="noopener"{% endif %}>
  201.                                             {{ slide.translated.buttonLinkText }}
  202.                                         </a>
  203.                                         {% endif %}
  204.                                         {% endblock %}
  205.                                     </div>
  206.                                     {% endblock %}
  207.                                     {% endblock %}
  208.                                 </div>
  209.                                 {% endif %}
  210.                                 {% endblock %}
  211.                             </div>
  212.                             {% endblock %}
  213.                             {% endblock %}
  214.                         </div>
  215.                         {% endfor %}
  216.                         {% endapply %}
  217.                     </div>
  218.                     {% if config.showNavigationControls and not controlsDisabled %}
  219.                     <button
  220.                         type="button"
  221.                         class="hero-slider-btn hero-slider-navigation-btn hero-slider-navigation-btn-left"
  222.                         aria-controls="hero-slider"
  223.                         aria-label="{{ 'neno-hero-slider.controls.prevTitle' | trans }}"
  224.                         title="{{ 'neno-hero-slider.controls.prevTitle' | trans }}"
  225.                     >
  226.                         {% block neno_hero_slider_prev_icon %}
  227.                             {% if customLeftArrowGraphic %}
  228.                                 <span
  229.                                     class="icon hs-custom-icon"
  230.                                     style="background-image: url('{{ customLeftArrowGraphic.url }}');"
  231.                                     role="presentation"
  232.                                 ></span>
  233.                             {% else %}
  234.                                 {% sw_icon 'arrow-head-left' %}
  235.                             {% endif %}
  236.                         {% endblock %}
  237.                     </button>
  238.                     <button
  239.                         type="button"
  240.                         class="hero-slider-btn hero-slider-navigation-btn hero-slider-navigation-btn-right"
  241.                         aria-controls="hero-slider"
  242.                         aria-label="{{ 'neno-hero-slider.controls.nextTitle' | trans }}"
  243.                         title="{{ 'neno-hero-slider.controls.nextTitle' | trans }}"
  244.                     >
  245.                         {% block neno_hero_slider_next_icon %}
  246.                             {% if customRightArrowGraphic %}
  247.                                 <span
  248.                                     class="icon hs-custom-icon"
  249.                                     style="background-image: url('{{ customRightArrowGraphic.url }}');"
  250.                                     role="presentation"
  251.                                 ></span>
  252.                             {% else %}
  253.                                 {% sw_icon 'arrow-head-right' %}
  254.                             {% endif %}
  255.                         {% endblock %}
  256.                     </button>
  257.                     {% endif %}
  258.                     {% if config.showJumpNavigation and not controlsDisabled %}
  259.                     <div class="hero-slider-menu hs-{{ config.bulletDirection ?: 'vertical' }}" role="menu">
  260.                         {% for slide in slides %}
  261.                             <button type="button" class="hero-slider-btn hero-slider-menu-item" role="menuitemradio"></button>
  262.                         {% endfor %}
  263.                     </div>
  264.                     {% endif %}
  265.                     {% if config.showScrollIndicator %}
  266.                     <div class="hero-slider-scroll-overlay hs-horizontal-align-{{ config.scrollIndicatorAlignment ?: 'center' }}" role="presentation">
  267.                         <button type="button" title="{{ 'neno-hero-slider.scrollDown'|trans }}" class="hero-slider-btn hero-slider-scroll-icon hs-interactive">
  268.                             {% if customScrollIndicatorGraphic %}
  269.                                 <span
  270.                                     class="icon hs-custom-icon"
  271.                                     style="background-image: url('{{ customScrollIndicatorGraphic.url }}');"
  272.                                     role="presentation"
  273.                                 ></span>
  274.                             {% else %}
  275.                                 {% sw_icon 'arrow-head-down' %}
  276.                             {% endif %}
  277.                         </button>
  278.                     </div>
  279.                     {% endif %}
  280.                     {% endblock %}
  281.                 </div>
  282.                 {% block neno_hero_slider_user_style %}
  283.                 <style>
  284.                     .hero-slider .hero-slider-navigation-btn {
  285.                     {% if config.navigationControlBackgroundColor %}
  286.                         background-color: {{ config.navigationControlBackgroundColor }};
  287.                     {% endif %}
  288.                     {% if config.navigationControlIconColor %}
  289.                         color: {{ config.navigationControlIconColor }};
  290.                     {% endif %}
  291.                     }
  292.                     .hero-slider .hero-slider-scroll-icon {
  293.                     {% if config.navigationControlBackgroundColor %}
  294.                         background-color: {{ config.scrollIndicatorBackgroundColor }};
  295.                     {% endif %}
  296.                     {% if config.navigationControlIconColor %}
  297.                         color: {{ config.scrollIndicatorIconColor }};
  298.                     {% endif %}
  299.                     }
  300.                     .hero-slider .hero-slider-menu-item {
  301.                     {% if config.jumpNavigationItemBackgroundColor %}
  302.                         background-color: {{ config.jumpNavigationItemBackgroundColor }};
  303.                     {% endif %}
  304.                     {% if config.jumpNavigationItemBorderColor %}
  305.                         border-color: {{ config.jumpNavigationItemBorderColor }};
  306.                     {% endif %}
  307.                     }
  308.                     .hero-slider .hero-slider-menu-item:after,
  309.                     .hero-slider .hero-slider-menu-item::after {
  310.                     {% if config.jumpNavigationItemFillColor %}
  311.                         background-color: {{ config.jumpNavigationItemFillColor }};
  312.                     {% endif %}
  313.                     }
  314.                     .hero-slider .btn.hero-slider-cta-btn {
  315.                     {% if config.ctaButtonType is same as('primary') %}
  316.                     {% if config.ctaButtonBackgroundColor %}
  317.                         background-color: {{ config.ctaButtonBackgroundColor }};
  318.                     {% endif %}
  319.                     {% if config.ctaButtonBackgroundColor %}
  320.                         border-color: {{ config.ctaButtonBackgroundColor }};
  321.                     {% endif %}
  322.                     {% if config.ctaButtonBackgroundColor %}
  323.                         color: {{ config.ctaButtonTextColor }};
  324.                     {% endif %}
  325.                     {% else %}
  326.                     {% if config.ctaButtonBackgroundColor %}
  327.                         border-color: {{ config.ctaButtonBackgroundColor }};
  328.                     {% endif %}
  329.                     {% if config.ctaButtonBackgroundColor %}
  330.                         color: {{ config.ctaButtonBackgroundColor }};
  331.                     {% endif %}
  332.                     {% endif %}
  333.                         font-family: {{ config.buttonFontFamily ? ('"' ~ config.buttonFontFamily ~ '"')|raw|sw_sanitize : 'inherit' }};
  334.                         font-size: {{ config.buttonFontSize ? (config.buttonFontSize ~ 'rem') : '.875rem' }};
  335.                         margin-bottom: {{ config.belowButtonGap ? (config.belowButtonGap ~ 'em') : '0' }};
  336.                     }
  337.                     .hero-slider .btn.hero-slider-cta-btn:hover {
  338.                     {% if config.ctaButtonType is same as('primary') %}
  339.                     {% if config.ctaButtonBackgroundColor %}
  340.                         background-color: {{ config.ctaButtonHoverBackgroundColor ?: config.ctaButtonBackgroundColor }};
  341.                     {% endif %}
  342.                     {% if config.ctaButtonBackgroundColor %}
  343.                         border-color: {{ config.ctaButtonBackgroundColor }};
  344.                     {% endif %}
  345.                     {% if config.ctaButtonTextColor %}
  346.                         color: {{ config.ctaButtonTextColor }};
  347.                     {% endif %}
  348.                     {% else %}
  349.                     {% if config.ctaButtonBackgroundColor %}
  350.                         border-color: {{ config.ctaButtonBackgroundColor }};
  351.                     {% endif %}
  352.                     {% if config.ctaButtonBackgroundColor %}
  353.                         background-color: {{ config.ctaButtonBackgroundColor }};
  354.                     {% endif %}
  355.                     {% if config.ctaButtonBackgroundColor %}
  356.                         color: {{ config.ctaButtonTextColor }};
  357.                     {% endif %}
  358.                     {% endif %}
  359.                     }
  360.                     .hero-slider .hero-slider-headline {
  361.                         color: {{ config.headlineColor ?: (config.defaultTextBlockColor ?: 'inherit') }};
  362.                         font-family: {{ config.headlineFontFamily ? ('"' ~ config.headlineFontFamily ~ '"')|raw|sw_sanitize : 'inherit' }};
  363.                         font-weight: {{ config.headlineFontWeight ?: 'bold' }};
  364.                         font-size: {{ config.headlineFontSizeXs ? (config.headlineFontSizeXs ~ 'rem') : 'initial' }};
  365.                         line-height: {{ config.headlineLineHeight ?: 'inherit' }};
  366.                         margin-bottom: {{ config.afterHeadlineGap ? (config.afterHeadlineGap ~ 'em') : '0' }};
  367.                     }
  368.                     .hero-slider .hero-slider-content-before {
  369.                         font-family: {{ config.textAboveHeadlineFontFamily ? ('"' ~ config.textAboveHeadlineFontFamily ~ '"')|raw|sw_sanitize : 'inherit' }};
  370.                         font-size: {{ config.fontSizeAboveHeadlineXs ? (config.fontSizeAboveHeadlineXs ~ 'rem') : 'initial' }};
  371.                         line-height: {{ config.textAboveHeadlineLineHeight ?: 'inherit' }};
  372.                         margin-bottom: {{ config.beforeHeadlineGap ? (config.beforeHeadlineGap ~ 'em') : '0' }};
  373.                     }
  374.                     .hero-slider .hero-slider-content-after {
  375.                         font-family: {{ config.textBelowHeadlineFontFamily ? ('"' ~ config.textBelowHeadlineFontFamily ~ '"')|raw|sw_sanitize : 'inherit' }};
  376.                         font-size: {{ config.fontSizeBelowHeadlineXs ? (config.fontSizeBelowHeadlineXs ~ 'rem') : 'initial' }};
  377.                         line-height: {{ config.textBelowHeadlineLineHeight ?: 'inherit' }};
  378.                         margin-bottom: {{ config.afterTextBelowHeadlineGap ? (config.afterTextBelowHeadlineGap ~ 'em') : '0' }};
  379.                     }
  380.                     {% if config.textTransitionMode is same as('fadein') %}
  381.                     .hero-slider .hero-slider-slide .hero-slider-description {
  382.                         opacity: 0;
  383.                         transition: opacity .7s ease, transform .5s ease;
  384.                         transition-delay: {{ config.transitionDuration ?: 0 }}s;
  385.                         transform: translateY(10%);
  386.                     }
  387.                     .hero-slider .hero-slider-slide.active .hero-slider-description {
  388.                         opacity: 1;
  389.                         transform: translateY(0);
  390.                     }
  391.                     {% endif %}
  392.                     @media all and (min-width: {{ (theme_config('breakpoint.md') - 1) ~ 'px' }}) {
  393.                         .hero-slider .hero-slider-headline {
  394.                             font-size: {{ config.headlineFontSizeMd ? (config.headlineFontSizeMd ~ 'rem') : 'initial' }};
  395.                         }
  396.                         .hero-slider .hero-slider-content-before {
  397.                             font-size: {{ config.fontSizeAboveHeadlineMd ? (config.fontSizeAboveHeadlineMd ~ 'rem') : 'initial' }};
  398.                         }
  399.                         .hero-slider .hero-slider-content-after {
  400.                             font-size: {{ config.fontSizeBelowHeadlineMd ? (config.fontSizeBelowHeadlineMd ~ 'rem') : 'initial' }};
  401.                         }
  402.                     }
  403.                     @media all and (min-width: {{ (theme_config('breakpoint.lg') - 1) ~ 'px' }}) {
  404.                         .hero-slider .hero-slider-headline {
  405.                             font-size: {{ config.headlineFontSizeLg ? (config.headlineFontSizeLg ~ 'rem') : 'initial' }};
  406.                         }
  407.                         .hero-slider .hero-slider-content-before {
  408.                             font-size: {{ config.fontSizeAboveHeadlineLg ? (config.fontSizeAboveHeadlineLg ~ 'rem') : 'initial' }};
  409.                         }
  410.                         .hero-slider .hero-slider-content-after {
  411.                             font-size: {{ config.fontSizeBelowHeadlineLg ? (config.fontSizeBelowHeadlineLg ~ 'rem') : 'initial' }};
  412.                         }
  413.                     }
  414.                     {{ config.userInjectedCSS ? (config.userInjectedCSS|raw|sw_sanitize) : '' }}
  415.                 </style>
  416.                 {% endblock %}
  417.                 {% block neno_hero_slider_init_script %}
  418.                 <script type="text/javascript">
  419.                     (function () {
  420.                         var forcePOnP = '{{ config.forceLoadPortraitImagesOnPortraitDevices }}' === '1';
  421.                         var forceLOnL = '{{ config.forceLoadPortraitImagesOnPortraitDevices }}' === '1';
  422.                         /* load first image without waiting for main script execution */
  423.                         var firstSlideImage = document.querySelector('img.hero-slider-image');
  424.                         function loadLandscapeImage() {
  425.                             var lsSrcSet = firstSlideImage.getAttribute('data-srcset-landscape');
  426.                             var lsSrc = firstSlideImage.getAttribute('data-src-landscape');
  427.                             if (lsSrcSet) {
  428.                                 firstSlideImage.srcSet = lsSrcSet;
  429.                             } else if (lsSrc) {
  430.                                 firstSlideImage.src = lsSrc;
  431.                             }
  432.                         }
  433.                         function loadPortraitImage() {
  434.                             var poSrcSet = firstSlideImage.getAttribute('data-srcset-portrait');
  435.                             var poSrc = firstSlideImage.getAttribute('data-src-portrait');
  436.                             if (poSrcSet) {
  437.                                 firstSlideImage.srcSet = poSrcSet;
  438.                             } else if (poSrc) {
  439.                                 firstSlideImage.src = poSrc;
  440.                             }
  441.                         }
  442.                         function fillHeight(el) {
  443.                             var vRect = el.getBoundingClientRect();
  444.                             el.style.height = (window.innerHeight - vRect.top) + 'px';
  445.                         }
  446.                         var el = document.querySelector('.hero-slider');
  447.                         var hsmLandscape = '{{ config.heightScaleMode }}';
  448.                         var hsmPortrait = '{{ config.heightScaleModePortrait }}';
  449.                         var hasFixedAspectL = hsmLandscape === 'fixed_aspect';
  450.                         var hasFixedAspectP = hsmPortrait === 'inherit' ? hasFixedAspectL : (hsmPortrait === 'fixed_aspect');
  451.                         var windowAspect = window.innerWidth / window.innerHeight;
  452.                         var isViewportP = (windowAspect < 1);
  453.                         var initWidth = el.getBoundingClientRect().width;
  454.                         /* prime slider height */
  455.                         if (isViewportP) {
  456.                             if (hasFixedAspectP) {
  457.                                 el.style.height = (1 / {{ aspectRatioPortrait }} * (initWidth || window.innerWidth)) + 'px';
  458.                             } else {
  459.                                 fillHeight(el);
  460.                             }
  461.                         } else {
  462.                             if (hasFixedAspectL) {
  463.                                 el.style.height = (1 / {{ aspectRatioLandscape }} * (initWidth || window.innerWidth)) + 'px';
  464.                             } else {
  465.                                 fillHeight(el);
  466.                             }
  467.                         }
  468.                         if (firstSlideImage) {
  469.                             if ('objectFit' in firstSlideImage.style) {
  470.                                 firstSlideImage.style.objectFit = 'cover';
  471.                                 firstSlideImage.style.objectPosition = 'center center';
  472.                             }
  473.                             if (isViewportP && forcePOnP) {
  474.                                 loadPortraitImage();
  475.                             } else if (!isViewportP && forceLOnL) {
  476.                                 loadLandscapeImage();
  477.                             } else {
  478.                                 var bRect = el.getBoundingClientRect();
  479.                                 var boxAspectRatio = (bRect.width / bRect.height);
  480.                                 if (boxAspectRatio < 1) {
  481.                                     loadPortraitImage();
  482.                                 } else {
  483.                                     loadLandscapeImage();
  484.                                 }
  485.                             }
  486.                             firstSlideImage.classList.add('hs-image-loaded');
  487.                         }
  488.                     })();
  489.                 </script>
  490.                 {% endblock %}
  491.             {% endif %}
  492.         {% endif %}
  493.     {% endif %}
  494. {% endblock %}