document.addEventListener('DOMContentLoaded', function() { $(document).ready(function(){ function galerythree(){ $(".galerythree").slick({ dots: true, dotsClass: 'galerydotsthree', arrows: true, slidesToShow: 1, slidesToScroll: 1, draggable: false, centerMode: true, centerPadding: '20%', autoplay: true, autoplaySpeed: 7000, speed: 800, }); var blocks = $(".galerycontthree").parents(".block-wrapper"); $.each(blocks,function(key,block) { var block = $(this); var id = block.attr("id"); $(".galeryhrefthree").attr("data-fancybox","gallery_"+id); }); var worksphoto = $(".gleryhrefimgthree"); $.each(worksphoto,function(key,item){ var url = $(item).attr('src'); url = url.replace(/.*\s?url\([\'\"]?/, '').replace(/[\'\"]?\).*/, '') $(item).parent().attr('href',url); }); $(".galeryhrefthree").fancybox(); } galerythree(); }); });