Want to use Julian Renaux's wonderful bttrlazyloading (1.0.8) script to load a long page with 300+ images so each image only lazy loads when they are in the window view. Works perfectly for tablet, laptop and desktop size screens, but for phone and iPod screens I want to load a 1 pixel image instead (or no image at all).
Here's my abbreviated HTML5 code...
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8" />
<link href="tvgc.css" type="text/css" rel="stylesheet" />
<link href="bttrlazyloading.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="jquery.bttrlazyloading.js"></script>
<script type="text/javascript">
<!--
$(function() {
$('img.bttrlazyloading').bttrlazyloading()
});
-->
</script>
<title>The Title</title>
</head>
<body>
<div class="left"><img id="imgA001" class="bttrlazyloading" alt="Image"
data-bttrlazyloading-xs='{"src": "dot.gif", "width" : 1, "height" : 1}'
data-bttrlazyloading-sm='{"src": "applebees4x2.jpg", "width" : 288, "height" : 160}'
data-bttrlazyloading-delay="500" /></div>
Applebee Description goes here
<div class="left"><img id="imgA002" class="bttrlazyloading" alt="Image"
data-bttrlazyloading-xs='{"src": "dot.gif", "width" : 1, "height" : 1}'
data-bttrlazyloading-sm='{"src": "athens3x2.jpg", "width" : 252, "height" : 168}'
data-bttrlazyloading-delay="500" /></div>
Athens Description goes here
<div class="left"><img id="imgA003" class="bttrlazyloading" alt="Image"
data-bttrlazyloading-xs='{"src": "dot.gif", "width" : 1, "height" : 1}'
data-bttrlazyloading-sm='{"src": "avalon3x2.jpg", "width" : 252, "height" : 168}'
data-bttrlazyloading-delay="500" /></div>
Avalon Description goes here
then 300 more
</body></html>
I also modified the bttrlazyloading javascript to this...
BttrLazyLoadingGlobal.options = {
xs: {
src: "dot.gif",
width: 1,
height: 1
},
sm: {
src: null,
width: 100,
height: 100
}
}
(since all images for xtra small screens would be the same)
My iPod and iPhone continue to load the full size image instead of the 1 pixel special image. What am I doing wrong?
Also it won't HTML validate unless I change to this (inserting src= ) code...
<img src="dot.gif" id="imgA001"
for each image. And seems to have no effect on the lazy loading (which is a good thing).
(I'm still learning JavaScript)
TIA, Rich C.