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