Skip to content

Commit f8daec6

Browse files
committed
lazy load images with jquery
1 parent 49841a5 commit f8daec6

File tree

7 files changed

+17
-5
lines changed

7 files changed

+17
-5
lines changed

_includes/language-icon.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<li>
22
<span class="icon">
3-
<img alt="{{include.language}}"
3+
<img alt="{{include.language}}" class="lazy"
44
src="images/devicons/{{include.icon}}"
55
height="75px"
66
width="75px"/>

_includes/modal.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div id="{{include.id}}" class="modal">
22
<div id="btn-close-modal" class="close-{{include.id}}">
3-
<img src="css/images/close.svg" alt="close" height="35px" width="35px"/>
3+
<img src="css/images/close.svg" alt="close" height="35px" width="35px" class="lazy"/>
44
</div>
55
<div class="modal-content">
66
<h3>{{include.title}}</h3>

_includes/scripts.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
<script src="{{ " /js/main.min.js " | prepend: site.baseurl }}"></script>
1111
<script src="{{ " /js/modals.min.js " | prepend: site.baseurl }}"></script>
1212
<script src="{{ " /js/lib/png2gif.min.js " | prepend: site.baseurl }}"></script>
13+
<script src="{{ " /js/lib/jquery.lazyload.min.js " | prepend: site.baseurl }}"></script>
1314
<script>!function(e,t,a,n,c,s,o){e.GoogleAnalyticsObject=c,e[c]=e[c]||function(){(e[c].q=e[c].q||[]).push(arguments)},e[c].l=1*new Date,s=t.createElement(a),o=t.getElementsByTagName(a)[0],s.async=1,s.src=n,o.parentNode.insertBefore(s,o)}(window,document,"script","https://www.google-analytics.com/analytics.js","ga"),ga("create","UA-44377274-8","auto"),ga("send","pageview");
1415
</script>

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ <h2>{{summary.title}}</h2>
4040
<div class="image">
4141
{% if feature.image.alt %}
4242
<a id="{{feature.image.id}}" href="#{{feature.image.href}}" class="modal-link">
43-
<img alt="{{feature.image.alt}}"
43+
<img alt="{{feature.image.alt}}" class="lazy"
4444
src="{{feature.image.src}}"
4545
height="328px" width="574px"/>
4646
</a>
4747
{% else %}
48-
<img alt="{{feature.image.alt}}"
48+
<img alt="{{feature.image.alt}}" class="lazy"
4949
src="{{feature.image.src}}"
5050
height="328px" width="574px" />
5151
{% endif %}

js/lib/jquery.lazyload.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/modals.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$(function() {
2+
// modals
23
$("#atom-coderoad").animatedModal({
34
modalTarget: 'atom-coderoad-demo',
45
animatedIn:'zoomIn',
@@ -15,4 +16,11 @@ $(function() {
1516
.attr("src", "images/demos/builder-demo.gif");
1617
}
1718
});
19+
20+
// images
21+
$("img.lazy").lazyload({
22+
effect: "fadeIn",
23+
threshold : 200,
24+
});
25+
1826
});

js/modals.min.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)