I am building a photo gallery and i wants to load the images only when the content "DIV" element comes into the viewport.I am using jquery viewport.js for this.
By default i am setting the src attribute of each "IMG" tag to "LOADING.JPEG" and when any div comes into the viewport i change the src attribute of IMG tag to the real image.But after changing the SRC attribute image do not change it still shows the LOADING.JPEG.
$(".content").each(function(i,obj){
var element = obj.id;
if($("#"+element).is(':in-viewport')){
var link = $("#"+element+" div a").attr('href');
//set the image src from loading to read image
$("#"+element+" div a img").attr('src',link);
}
});
Any help or suggestion would be greatly appreciated.
Thanks