hugo-internet-weblog/static/js/weblog.js

34 lines
885 B
JavaScript
Raw Normal View History

2016-02-19 23:35:42 -05:00
var iweblog = {};
iweblog.application = function() {
// @sumamary: format flickr results for display
function _display_images(data, count) {
var htmlString = "", cnt = 0;
$.each(data.items, function(i,item){
if (cnt == count) return;
var title = item.title;
2016-02-19 23:35:42 -05:00
var image = item.media.m;
var smallImage = image.replace("_m.jpg", "_s.jpg");
var largeImage = image.replace("_m.jpg", "_b.jpg");
htmlString += "<a data-lightbox=\"lightbox\" data-title=\"" + title + "\" class=\"photo-item\" href=\"" + largeImage + "\">";
2024-02-24 21:50:25 -05:00
htmlString += "<img loading=\"lazy\" src=\"" + smallImage + "\" />";
2016-02-19 23:35:42 -05:00
htmlString += "</a>";
cnt++;
});
$('#photos').html(htmlString);
2016-02-19 23:35:42 -05:00
}
return {
displayImages: function(data, count) { _display_images(data, count); }
}
}();
/// configure lightbox
lightbox.option({
'resizeDuration': 400,
'wrapAround': true
})