templates/layouts/layouts_front/common/script/custom_scripts_bottom.html.twig line 1

Open in your IDE?
  1. {# Custom script MOBIRISE #}
  2. <script>
  3.     "use strict";
  4.     if ("loading" in HTMLImageElement.prototype) {
  5.         document.querySelectorAll('img[loading="lazy"],iframe[loading="lazy"]').forEach(e => {
  6.             e.src = e.dataset.src, e.style.paddingTop = 100 * e.getAttribute("data-aspectratio") + "%", e.style.height = 0, e.onload = function () {
  7.                 e.removeAttribute("style")
  8.             }
  9.         })
  10.     } else {
  11.         const e = document.createElement("script");
  12.         e.src = "https://cdnjs.cloudflare.com/ajax/libs/lazysizes/5.1.2/lazysizes.min.js", document.body.appendChild(e)
  13.     }
  14. </script>