Hi,
I’m trying to improve the spped on my app by using lazy image load, but I can’t get the syntax right…
I’m building a list like below – I think (but i’m not sure) that I should use the “Images inside a Container-Element”
Link to documentation: http://jquery.eisbehr.de/lazy/index.php?c=container
I very much appreciate any help.
function render_list( container_id , list_items ) {
var container = $("#" + container_id);
var list = $("ul[class*=m1-list]" , container);
var clone = $("li:first" , list).clone();
var list_height = list.outerHeight();
$("li" , list).remove();
var length = list_items.length;
var item = null;
for (var i = 0; i < length; i++) {
item = list_items[i];
$(clone).removeClass("m1-first m1-last");
if(i == 0)
$(clone).addClass("m1-first");
if(i == length-1)
$(clone).addClass("m1-last");
$(clone).attr("data-listitem-index" , i);
//lazy load->
if(item["img"]){
//$("div[id*=txtImg]",clone).html('<img src="'+item["img"]+'" width="60" align="top">'); //Works without lazy load
$("div[id*=txtImg]",clone).html('<img class="lazy" data-src="'+item["img"]+'" src="" border="0" alt="Test" width="60" align="top">'); //Do not work
}
....