diff options
author | XhmikosR <xhmikosr@gmail.com> | 2022-07-22 22:37:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-22 22:37:24 +0300 |
commit | dd2aa1b6df3622e2a6ff2e94b85fda4517ee42f9 (patch) | |
tree | 4e60bd79e8db145d3bdc7d8714114f207dec9e49 | |
parent | 90eab0d0e8a5f3db2df74494410623d1de0a579b (diff) |
Async load Bootstrap JS (#299)
-rw-r--r-- | src/layouts/partials/scripts.html | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/layouts/partials/scripts.html b/src/layouts/partials/scripts.html index 1a2ae702..ad131cc4 100644 --- a/src/layouts/partials/scripts.html +++ b/src/layouts/partials/scripts.html @@ -1,20 +1,21 @@ -{{ $bootstrapJs := resources.Get "/js/bootstrap.min.js" }} -<script src="{{ $bootstrapJs.Permalink | relURL }}"></script> +{{- $bootstrapJs := resources.Get "/js/bootstrap.min.js" -}} + +<script async src="{{ $bootstrapJs.Permalink | relURL }}"></script> <script> (function(w, d) { - var b = d.getElementsByTagName('body')[0]; - var s = d.createElement('script'); - var io = 'IntersectionObserver' in w && 'IntersectionObserverEntry' in w && - 'intersectionRatio' in w.IntersectionObserverEntry.prototype && - 'isIntersecting' in w.IntersectionObserverEntry.prototype; - var v = io ? '17.x' : '8.x'; - s.async = true; - s.src = '/assets/js/vendor/lazyload.' + v + '.iife.min.js'; - w.lazyLoadOptions = { - elements_selector: '.lazy', - threshold: 150 - }; - b.appendChild(s); + var b = d.getElementsByTagName('body')[0]; + var s = d.createElement('script'); + var io = 'IntersectionObserver' in w && 'IntersectionObserverEntry' in w && + 'intersectionRatio' in w.IntersectionObserverEntry.prototype && + 'isIntersecting' in w.IntersectionObserverEntry.prototype; + var v = io ? '17.x' : '8.x'; + s.async = true; + s.src = '/assets/js/vendor/lazyload.' + v + '.iife.min.js'; + w.lazyLoadOptions = { + elements_selector: '.lazy', + threshold: 150 + }; + b.appendChild(s); }(window, document)); </script> |