Move lozad.

This commit is contained in:
Cotes Chung 2019-12-02 01:15:55 +08:00
parent ebbd818223
commit 924cfa7426
3 changed files with 8 additions and 9 deletions

View file

@ -75,10 +75,8 @@
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/syntax.css"> <link rel="stylesheet" href="{{ site.baseurl }}/assets/css/syntax.css">
{% endif %} {% endif %}
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js" <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script> integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script> <script>
document.jQuery || document.write("<script src=\"{{ site.baseurl }}/assets/lib/jquery-3.4.1.min.js\"><\/script>"); document.jQuery || document.write("<script src=\"{{ site.baseurl }}/assets/lib/jquery-3.4.1.min.js\"><\/script>");
</script> </script>
@ -89,8 +87,6 @@
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js"
integrity="sha256-5+02zu5UULQkO7w1GIr6vftCgMfFdZcAHeDtFnKZsBs=" crossorigin="anonymous" async></script> integrity="sha256-5+02zu5UULQkO7w1GIr6vftCgMfFdZcAHeDtFnKZsBs=" crossorigin="anonymous" async></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/dist/commons.js" async></script> <script src="{{ site.baseurl }}/assets/js/dist/commons.js" async></script>
{% if page.layout == 'home' or page.layout == 'post' %} {% if page.layout == 'home' or page.layout == 'post' %}

7
_includes/lozad.html Normal file
View file

@ -0,0 +1,7 @@
<!-- image lazy load -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js"></script>
<script type="text/javascript">
const observer = lozad();
observer.observe();
</script>

View file

@ -118,8 +118,4 @@ layout: default
</div> <!-- .row --> </div> <!-- .row -->
<!-- image lazy load --> {% include lozad.html %}
<script type="text/javascript">
const observer = lozad();
observer.observe();
</script>