howed var element = document.createElement("a"); $(element).attr("data-fancybox", "gallery"); $(element).attr("href", $(this).attr("src")); $(this).wrap(element); }); clearInterval(fancyTimer); }); }, 10);