Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/blog.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2022-07-22 22:37:24 +0300
committerGitHub <noreply@github.com>2022-07-22 22:37:24 +0300
commitdd2aa1b6df3622e2a6ff2e94b85fda4517ee42f9 (patch)
tree4e60bd79e8db145d3bdc7d8714114f207dec9e49
parent90eab0d0e8a5f3db2df74494410623d1de0a579b (diff)
Async load Bootstrap JS (#299)
-rw-r--r--src/layouts/partials/scripts.html31
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>