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.                                     {% block neno_hero_slider_slide %}
  90.                                         {% if slide.mediaLandscape %}
  91.                                             {% set alt_title_landscape = slide.translated.imageAltTitle ?: slide.mediaLandscape.alt %}
  92.                                         {% endif %}
  93.                                         {% if slide.mediaPortrait %}
  94.                                             {% set alt_title_portrait = slide.translated.imageAltTitle ?: slide.mediaLandscape.alt %}
  95.                                         {% endif %}
  96.                                         <div
  97.                                             class="hero-slider-slide{% if slide.cssClass %} {{ slide.cssClass|sw_sanitize }}{% endif %}"
  98.                                             data-animation-duration="{% block neno_hero_slider_image_anim_duration %}60{% endblock %}"
  99.                                             data-animation-preset-landscape="{{ slide.imageMovementPresetLandscape ?: 'NONE' }}"
  100.                                             data-animation-preset-portrait="{{ slide.imageMovementPresetPortrait ?: 'NONE' }}"
  101.                                             style="background-color: {{ slide.backgroundColor ?: 'transparent' }}"
  102.                                         >
  103.                                             {% block neno_hero_slider_slide_inner %}
  104.                                                 {% block neno_hero_slider_slide_image %}
  105.                                                     {% if slide.mediaLandscape or slide.mediaPortrait %}
  106.                                                         <img
  107.                                                             class="hero-slider-image"
  108.                                                             alt="{{ slide.translated.imageAltTitle ?: (slide.mediaLandscape.alt ?: slide.mediaPortrait.alt) }}"
  109.                                                             {% apply spaceless %}
  110.                                                                 {% if slide.mediaPortrait %}
  111.                                                                     {% block neno_hero_slider_slide_portrait_srcset %}
  112.                                                                         {% if slide.mediaPortrait.thumbnails|length > 0 %}
  113.                                                                             {% set thumbnails = slide.mediaPortrait.thumbnails|sort((a, b) => b.width <=> a.width) %}
  114.                                                                             {# generate srcset with all available thumbnails #}
  115.                                                                             {% set srcsetValue %}{% apply spaceless %}
  116.                                                                                 {{ 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 %}
  117.                                                                             {% endapply %}{% endset %}
  118.                                                                             data-srcset-portrait="{{ srcsetValue }}"
  119.                                                                         {% endif %}
  120.                                                                         data-src-portrait="{{ slide.mediaPortrait|sw_encode_media_url }}"
  121.                                                                     {% endblock %}
  122.                                                                 {% endif %}
  123.                                                                 {% if slide.mediaLandscape %}
  124.                                                                     {% block neno_hero_slider_slide_landscape_srcset %}
  125.                                                                         {% if slide.mediaLandscape.thumbnails|length > 0 %}
  126.                                                                             {% set thumbnails = slide.mediaLandscape.thumbnails|sort((a, b) => b.width <=> a.width) %}
  127.                                                                             {# generate srcset with all available thumbnails #}
  128.                                                                             {% set srcsetValue %}{% apply spaceless %}
  129.                                                                                 {{ 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 %}
  130.                                                                             {% endapply %}{% endset %}
  131.                                                                             data-srcset-landscape="{{ srcsetValue }}"
  132.                                                                         {% endif %}
  133.                                                                         data-src-landscape="{{ slide.mediaLandscape|sw_encode_media_url }}"
  134.                                                                     {% endblock %}
  135.                                                                 {% endif %}
  136.                                                             {% endapply %}
  137.                                                             sizes="100vw"
  138.                                                         >
  139.                                                         <noscript>
  140.                                                             {% if slide.mediaLandscape %}
  141.                                                                 {% sw_thumbnails 'hero-slider-thumbnails-landscape' with {
  142.                                                                     media: slide.mediaLandscape,
  143.                                                                     attributes: {
  144.                                                                         alt: alt_title_landscape,
  145.                                                                         class: 'hero-slider-thumbnails hero-slider-thumbnails-landscape'
  146.                                                                     }
  147.                                                                 } %}
  148.                                                             {% endif %}
  149.                                                             {% if slide.mediaPortrait %}
  150.                                                                 {% sw_thumbnails 'hero-slider-thumbnails-portrait' with {
  151.                                                                     media: slide.mediaPortrait,
  152.                                                                     attributes: {
  153.                                                                         alt: alt_title_portrait,
  154.                                                                         class: 'hero-slider-thumbnails hero-slider-thumbnails-portrait'
  155.                                                                     }
  156.                                                                 } %}
  157.                                                             {% endif %}
  158.                                                         </noscript>
  159.                                                         </img>
  160.                                                     {% endif %}
  161.                                                 {% endblock %}
  162.                                                 {% block neno_hero_slider_slide_overlay %}
  163.                                                     <div class="hero-slider-overlay" role="presentation"
  164.                                                          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"
  169.                                                            href="{{ slide.translated.slideLink }}"
  170.                                                            title="{{ slide.translated.buttonLinkText ?: ('neno-hero-slider.openLink'|trans) }}" {% if slide.slideLinkNewTab %} target="_blank" rel="noopener"{% endif %}
  171.                                                            draggable="false"></a>
  172.                                                     {% endif %}
  173.                                                 {% endblock %}
  174.                                                 {% block neno_hero_slider_slide_content %}
  175.                                                     <div
  176.                                                         class="hero-slider-content-container hs-vertical-align-{{ config.verticalTextBlockAlignment ?: 'center' }} hs-horizontal-align-{{ config.horizontalTextBlockAlignment ?: 'left' }}">
  177.                                                         {% block neno_hero_slider_slide_content_inner %}
  178.                                                             {% if slide.translated.textContentBeforeHeadline or slide.translated.headline or slide.translated.textContentAfterHeadline or slide.translated.buttonLink %}
  179.                                                                 <div
  180.                                                                     class="hero-slider-description hs-t-align-{{ config.defaultTextAlignment ?: 'left' }}"
  181.                                                                     style="background-color: {{ config.textBlockBackgroundColor ?: 'transparent' }}; color: {{ config.defaultTextBlockColor ?: 'white' }}">
  182.                                                                     {% block neno_hero_slider_slide_description_inner %}
  183.                                                                         {% block neno_hero_slider_slide_content_before %}
  184.                                                                             <div class="hero-slider-content-before">
  185.                                                                                 {% block neno_hero_slider_slide_content_before_inner %}
  186.                                                                                     {{ ((slide.translated.textContentBeforeHeadline|raw) ?: '')|sw_sanitize }}
  187.                                                                                 {% endblock %}
  188.                                                                             </div>
  189.                                                                         {% endblock %}
  190.                                                                         {% set headline_tag_name = (loop.first ? (config.headlineTagNameFirstSlide ?: 'h2') : ((config.headlineTagNameFollowingSlides ?: 'h2'))) %}
  191.                                                                         {% block neno_hero_slider_slide_headline %}
  192.                                                                             {% if slide.translated.headlineNl2Br %}
  193.                                                                                 {% set headline_content %}{{ ((slide.translated.headline|raw) ?: '')|nl2br|sw_sanitize }}{% endset %}
  194.                                                                             {% else %}
  195.                                                                                 {% set headline_content %}{{ ((slide.translated.headline|raw) ?: '')|sw_sanitize }}{% endset %}
  196.                                                                             {% endif %}
  197.                                                                             {% set headline_html %}<{{ headline_tag_name }} class="hero-slider-headline">{{ headline_content }}{{ '</'|raw }}{{ headline_tag_name }}>{% endset %}
  198.                                                                             {{ headline_html }}
  199.                                                                         {% endblock %}
  200.                                                                         {% block neno_hero_slider_slide_content_after %}
  201.                                                                             <div class="hero-slider-content-after">
  202.                                                                                 {% block neno_hero_slider_slide_content_after_inner %}
  203.                                                                                     {{ ((slide.translated.textContentAfterHeadline|raw) ?: '')|sw_sanitize }}
  204.                                                                                 {% endblock %}
  205.                                                                             </div>
  206.                                                                         {% endblock %}
  207.                                                                         {% block neno_hero_slider_slide_cta_container %}
  208.                                                                             <div
  209.                                                                                 class="hero-slider-cta-container hs-t-align-{{ config.ctaButtonAlignment ?: 'left' }}">
  210.                                                                                 {% block neno_hero_slider_slide_cta_container_inner %}
  211.                                                                                     {% if slide.translated.buttonLink %}
  212.                                                                                         <a class="btn btn-{{ config.ctaButtonType ?: 'primary' }} hero-slider-cta-btn"
  213.                                                                                            title="{{ slide.translated.buttonLinkText }}"
  214.                                                                                            tabindex="-1"
  215.                                                                                            href="{{ slide.translated.buttonLink }}"{% if slide.buttonLinkNewTab %} target="_blank" rel="noopener"{% endif %}>
  216.                                                                                             {{ slide.translated.buttonLinkText }}
  217.                                                                                         </a>
  218.                                                                                     {% endif %}
  219.                                                                                 {% endblock %}
  220.                                                                             </div>
  221.                                                                         {% endblock %}
  222.                                                                     {% endblock %}
  223.                                                                 </div>
  224.                                                             {% endif %}
  225.                                                         {% endblock %}
  226.                                                     </div>
  227.                                                 {% endblock %}
  228.                                             {% endblock %}
  229.                                         </div>
  230.                                     {% endblock %}
  231.                                 {% endfor %}
  232.                             {% endapply %}
  233.                         </div>
  234.                         {% if config.showNavigationControls and not controlsDisabled %}
  235.                             <button
  236.                                 type="button"
  237.                                 class="hero-slider-btn hero-slider-navigation-btn hero-slider-navigation-btn-left"
  238.                                 aria-controls="hero-slider"
  239.                                 aria-label="{{ 'neno-hero-slider.controls.prevTitle' | trans }}"
  240.                                 title="{{ 'neno-hero-slider.controls.prevTitle' | trans }}"
  241.                             >
  242.                                 {% block neno_hero_slider_prev_icon %}
  243.                                     {% if customLeftArrowGraphic %}
  244.                                         <span
  245.                                             class="icon hs-custom-icon"
  246.                                             style="background-image: url('{{ customLeftArrowGraphic.url }}');"
  247.                                             role="presentation"
  248.                                         ></span>
  249.                                     {% else %}
  250.                                         {% sw_icon 'arrow-head-left' %}
  251.                                     {% endif %}
  252.                                 {% endblock %}
  253.                             </button>
  254.                             <button
  255.                                 type="button"
  256.                                 class="hero-slider-btn hero-slider-navigation-btn hero-slider-navigation-btn-right"
  257.                                 aria-controls="hero-slider"
  258.                                 aria-label="{{ 'neno-hero-slider.controls.nextTitle' | trans }}"
  259.                                 title="{{ 'neno-hero-slider.controls.nextTitle' | trans }}"
  260.                             >
  261.                                 {% block neno_hero_slider_next_icon %}
  262.                                     {% if customRightArrowGraphic %}
  263.                                         <span
  264.                                             class="icon hs-custom-icon"
  265.                                             style="background-image: url('{{ customRightArrowGraphic.url }}');"
  266.                                             role="presentation"
  267.                                         ></span>
  268.                                     {% else %}
  269.                                         {% sw_icon 'arrow-head-right' %}
  270.                                     {% endif %}
  271.                                 {% endblock %}
  272.                             </button>
  273.                         {% endif %}
  274.                         {% if config.showJumpNavigation and not controlsDisabled %}
  275.                             <div class="hero-slider-menu hs-{{ config.bulletDirection ?: 'vertical' }}" role="menu">
  276.                                 {% for slide in slides %}
  277.                                     <button type="button" class="hero-slider-btn hero-slider-menu-item"
  278.                                             role="menuitemradio"></button>
  279.                                 {% endfor %}
  280.                             </div>
  281.                         {% endif %}
  282.                         {% if config.showScrollIndicator %}
  283.                             <div
  284.                                 class="hero-slider-scroll-overlay hs-horizontal-align-{{ config.scrollIndicatorAlignment ?: 'center' }}"
  285.                                 role="presentation">
  286.                                 <button type="button" title="{{ 'neno-hero-slider.scrollDown'|trans }}"
  287.                                         class="hero-slider-btn hero-slider-scroll-icon hs-interactive">
  288.                                     {% if customScrollIndicatorGraphic %}
  289.                                         <span
  290.                                             class="icon hs-custom-icon"
  291.                                             style="background-image: url('{{ customScrollIndicatorGraphic.url }}');"
  292.                                             role="presentation"
  293.                                         ></span>
  294.                                     {% else %}
  295.                                         {% sw_icon 'arrow-head-down' %}
  296.                                     {% endif %}
  297.                                 </button>
  298.                             </div>
  299.                         {% endif %}
  300.                     {% endblock %}
  301.                 </div>
  302.                 {% block neno_hero_slider_user_style %}
  303.                     <style>
  304.                         .hero-slider .hero-slider-navigation-btn {
  305.                         {% if config.navigationControlBackgroundColor %} background-color: {{ config.navigationControlBackgroundColor }};
  306.                         {% endif %}{% if config.navigationControlIconColor %} color: {{ config.navigationControlIconColor }};
  307.                         {% endif %}
  308.                         }
  309.                         .hero-slider .hero-slider-scroll-icon {
  310.                         {% if config.navigationControlBackgroundColor %} background-color: {{ config.scrollIndicatorBackgroundColor }};
  311.                         {% endif %}{% if config.navigationControlIconColor %} color: {{ config.scrollIndicatorIconColor }};
  312.                         {% endif %}
  313.                         }
  314.                         .hero-slider .hero-slider-menu-item {
  315.                         {% if config.jumpNavigationItemBackgroundColor %} background-color: {{ config.jumpNavigationItemBackgroundColor }};
  316.                         {% endif %}{% if config.jumpNavigationItemBorderColor %} border-color: {{ config.jumpNavigationItemBorderColor }};
  317.                         {% endif %}
  318.                         }
  319.                         .hero-slider .hero-slider-menu-item:after,
  320.                         .hero-slider .hero-slider-menu-item::after {
  321.                         {% if config.jumpNavigationItemFillColor %} background-color: {{ config.jumpNavigationItemFillColor }};
  322.                         {% endif %}
  323.                         }
  324.                         .hero-slider .btn.hero-slider-cta-btn {
  325.                         {% if config.ctaButtonType is same as('primary') %}{% if config.ctaButtonBackgroundColor %} background-color: {{ config.ctaButtonBackgroundColor }};
  326.                         {% endif %}{% if config.ctaButtonBackgroundColor %} border-color: {{ config.ctaButtonBackgroundColor }};
  327.                         {% endif %}{% if config.ctaButtonBackgroundColor %} color: {{ config.ctaButtonTextColor }};
  328.                         {% endif %}{% else %}{% if config.ctaButtonBackgroundColor %} border-color: {{ config.ctaButtonBackgroundColor }};
  329.                         {% endif %}{% if config.ctaButtonBackgroundColor %} color: {{ config.ctaButtonBackgroundColor }};
  330.                         {% endif %}{% endif %} font-family: {{ config.buttonFontFamily ? ('"' ~ config.buttonFontFamily ~ '"')|raw|sw_sanitize : 'inherit' }};
  331.                             font-size: {{ config.buttonFontSize ? (config.buttonFontSize ~ 'rem') : '.875rem' }};
  332.                             margin-bottom: {{ config.belowButtonGap ? (config.belowButtonGap ~ 'em') : '0' }};
  333.                         }
  334.                         .hero-slider .btn.hero-slider-cta-btn:hover {
  335.                         {% if config.ctaButtonType is same as('primary') %}{% if config.ctaButtonBackgroundColor %} background-color: {{ config.ctaButtonHoverBackgroundColor ?: config.ctaButtonBackgroundColor }};
  336.                         {% endif %}{% if config.ctaButtonBackgroundColor %} border-color: {{ config.ctaButtonBackgroundColor }};
  337.                         {% endif %}{% if config.ctaButtonTextColor %} color: {{ config.ctaButtonTextColor }};
  338.                         {% endif %}{% else %}{% if config.ctaButtonBackgroundColor %} border-color: {{ config.ctaButtonBackgroundColor }};
  339.                         {% endif %}{% if config.ctaButtonBackgroundColor %} background-color: {{ config.ctaButtonBackgroundColor }};
  340.                         {% endif %}{% if config.ctaButtonBackgroundColor %} color: {{ config.ctaButtonTextColor }};
  341.                         {% endif %}{% endif %}
  342.                         }
  343.                         .hero-slider .hero-slider-headline {
  344.                             color: {{ config.headlineColor ?: (config.defaultTextBlockColor ?: 'inherit') }};
  345.                             font-family: {{ config.headlineFontFamily ? ('"' ~ config.headlineFontFamily ~ '"')|raw|sw_sanitize : 'inherit' }};
  346.                             font-weight: {{ config.headlineFontWeight ?: 'bold' }};
  347.                             font-size: {{ config.headlineFontSizeXs ? (config.headlineFontSizeXs ~ 'rem') : 'initial' }};
  348.                             line-height: {{ config.headlineLineHeight ?: 'inherit' }};
  349.                             margin-bottom: {{ config.afterHeadlineGap ? (config.afterHeadlineGap ~ 'em') : '0' }};
  350.                         }
  351.                         .hero-slider .hero-slider-content-before {
  352.                             font-family: {{ config.textAboveHeadlineFontFamily ? ('"' ~ config.textAboveHeadlineFontFamily ~ '"')|raw|sw_sanitize : 'inherit' }};
  353.                             font-size: {{ config.fontSizeAboveHeadlineXs ? (config.fontSizeAboveHeadlineXs ~ 'rem') : 'initial' }};
  354.                             line-height: {{ config.textAboveHeadlineLineHeight ?: 'inherit' }};
  355.                             margin-bottom: {{ config.beforeHeadlineGap ? (config.beforeHeadlineGap ~ 'em') : '0' }};
  356.                         }
  357.                         .hero-slider .hero-slider-content-after {
  358.                             font-family: {{ config.textBelowHeadlineFontFamily ? ('"' ~ config.textBelowHeadlineFontFamily ~ '"')|raw|sw_sanitize : 'inherit' }};
  359.                             font-size: {{ config.fontSizeBelowHeadlineXs ? (config.fontSizeBelowHeadlineXs ~ 'rem') : 'initial' }};
  360.                             line-height: {{ config.textBelowHeadlineLineHeight ?: 'inherit' }};
  361.                             margin-bottom: {{ config.afterTextBelowHeadlineGap ? (config.afterTextBelowHeadlineGap ~ 'em') : '0' }};
  362.                         }
  363.                         {% if config.textTransitionMode is same as('fadein') %}
  364.                         .hero-slider .hero-slider-slide .hero-slider-description {
  365.                             opacity: 0;
  366.                             transition: opacity .7s ease, transform .5s ease;
  367.                             transition-delay: {{ config.transitionDuration ?: 0 }}s;
  368.                             transform: translateY(10%);
  369.                         }
  370.                         .hero-slider .hero-slider-slide.active .hero-slider-description {
  371.                             opacity: 1;
  372.                             transform: translateY(0);
  373.                         }
  374.                         {% endif %}
  375.                         @media all and (min-width: {{ (theme_config('breakpoint.md') - 1) ~ 'px' }}) {
  376.                             .hero-slider .hero-slider-headline {
  377.                                 font-size: {{ config.headlineFontSizeMd ? (config.headlineFontSizeMd ~ 'rem') : 'initial' }};
  378.                             }
  379.                             .hero-slider .hero-slider-content-before {
  380.                                 font-size: {{ config.fontSizeAboveHeadlineMd ? (config.fontSizeAboveHeadlineMd ~ 'rem') : 'initial' }};
  381.                             }
  382.                             .hero-slider .hero-slider-content-after {
  383.                                 font-size: {{ config.fontSizeBelowHeadlineMd ? (config.fontSizeBelowHeadlineMd ~ 'rem') : 'initial' }};
  384.                             }
  385.                         }
  386.                         @media all and (min-width: {{ (theme_config('breakpoint.lg') - 1) ~ 'px' }}) {
  387.                             .hero-slider .hero-slider-headline {
  388.                                 font-size: {{ config.headlineFontSizeLg ? (config.headlineFontSizeLg ~ 'rem') : 'initial' }};
  389.                             }
  390.                             .hero-slider .hero-slider-content-before {
  391.                                 font-size: {{ config.fontSizeAboveHeadlineLg ? (config.fontSizeAboveHeadlineLg ~ 'rem') : 'initial' }};
  392.                             }
  393.                             .hero-slider .hero-slider-content-after {
  394.                                 font-size: {{ config.fontSizeBelowHeadlineLg ? (config.fontSizeBelowHeadlineLg ~ 'rem') : 'initial' }};
  395.                             }
  396.                         }
  397.                         {{ config.userInjectedCSS ? (config.userInjectedCSS|raw|sw_sanitize) : '' }}
  398.                     </style>
  399.                 {% endblock %}
  400.                 {% block neno_hero_slider_init_script %}
  401.                     <script type="text/javascript">
  402.                         (function () {
  403.                             var forcePOnP = '{{ config.forceLoadPortraitImagesOnPortraitDevices }}' === '1';
  404.                             var forceLOnL = '{{ config.forceLoadPortraitImagesOnPortraitDevices }}' === '1';
  405.                             /* load first image without waiting for main script execution */
  406.                             var firstSlideImage = document.querySelector('img.hero-slider-image');
  407.                             function loadLandscapeImage() {
  408.                                 var lsSrcSet = firstSlideImage.getAttribute('data-srcset-landscape');
  409.                                 var lsSrc = firstSlideImage.getAttribute('data-src-landscape');
  410.                                 if (lsSrcSet) {
  411.                                     firstSlideImage.srcSet = lsSrcSet;
  412.                                 } else if (lsSrc) {
  413.                                     firstSlideImage.src = lsSrc;
  414.                                 }
  415.                             }
  416.                             function loadPortraitImage() {
  417.                                 var poSrcSet = firstSlideImage.getAttribute('data-srcset-portrait');
  418.                                 var poSrc = firstSlideImage.getAttribute('data-src-portrait');
  419.                                 if (poSrcSet) {
  420.                                     firstSlideImage.srcSet = poSrcSet;
  421.                                 } else if (poSrc) {
  422.                                     firstSlideImage.src = poSrc;
  423.                                 }
  424.                             }
  425.                             function fillHeight(el) {
  426.                                 var vRect = el.getBoundingClientRect();
  427.                                 el.style.height = (window.innerHeight - vRect.top) + 'px';
  428.                             }
  429.                             var el = document.querySelector('.hero-slider');
  430.                             var hsmLandscape = '{{ config.heightScaleMode }}';
  431.                             var hsmPortrait = '{{ config.heightScaleModePortrait }}';
  432.                             var hasFixedAspectL = hsmLandscape === 'fixed_aspect';
  433.                             var hasFixedAspectP = hsmPortrait === 'inherit' ? hasFixedAspectL : (hsmPortrait === 'fixed_aspect');
  434.                             var windowAspect = window.innerWidth / window.innerHeight;
  435.                             var isViewportP = (windowAspect < 1);
  436.                             var initWidth = el.getBoundingClientRect().width;
  437.                             /* prime slider height */
  438.                             if (isViewportP) {
  439.                                 if (hasFixedAspectP) {
  440.                                     el.style.height = (1 / {{ aspectRatioPortrait }} * (initWidth || window.innerWidth)) + 'px';
  441.                                 } else {
  442.                                     fillHeight(el);
  443.                                 }
  444.                             } else {
  445.                                 if (hasFixedAspectL) {
  446.                                     el.style.height = (1 / {{ aspectRatioLandscape }} * (initWidth || window.innerWidth)) + 'px';
  447.                                 } else {
  448.                                     fillHeight(el);
  449.                                 }
  450.                             }
  451.                             if (firstSlideImage) {
  452.                                 if ('objectFit' in firstSlideImage.style) {
  453.                                     firstSlideImage.style.objectFit = 'cover';
  454.                                     firstSlideImage.style.objectPosition = 'center center';
  455.                                 }
  456.                                 if (isViewportP && forcePOnP) {
  457.                                     loadPortraitImage();
  458.                                 } else if (!isViewportP && forceLOnL) {
  459.                                     loadLandscapeImage();
  460.                                 } else {
  461.                                     var bRect = el.getBoundingClientRect();
  462.                                     var boxAspectRatio = (bRect.width / bRect.height);
  463.                                     if (boxAspectRatio < 1) {
  464.                                         loadPortraitImage();
  465.                                     } else {
  466.                                         loadLandscapeImage();
  467.                                     }
  468.                                 }
  469.                                 firstSlideImage.classList.add('hs-image-loaded');
  470.                             }
  471.                         })();
  472.                     </script>
  473.                 {% endblock %}
  474.             {% endif %}
  475.         {% endif %}
  476.     {% endif %}
  477. {% endblock %}