francescomecca.eu/output/assets/js/gallery.min.js

2 lines
893 B
JavaScript
Raw Normal View History

2018-11-10 18:19:00 +01:00
function renderGallery(t,e){var i=document.getElementById("gallery_container");i.innerHTML="";var l=require("justified-layout")(t,{containerWidth:i.offsetWidth,targetRowHeight:.6*e,boxSpacing:5});i.style.height=l.containerHeight+"px";for(var n=l.boxes,r=0;r<n.length;r++){var a=document.createElement("img");a.setAttribute("src",t[r].url_thumb),a.setAttribute("alt",t[r].title),a.style.width=n[r].width+"px",a.style.height=n[r].height+"px",link=document.createElement("a"),link.setAttribute("href",t[r].url),link.setAttribute("class","image-reference"),div=document.createElement("div"),div.setAttribute("class","image-block"),div.setAttribute("title",t[r].title),div.setAttribute("data-toggle","tooltip"),div.style.width=n[r].width+"px",div.style.height=n[r].height+"px",div.style.top=n[r].top+"px",div.style.left=n[r].left+"px",link.appendChild(a),div.appendChild(link),i.appendChild(div)}}