;(function ($, window, document, undefined) { 'use strict'; // FRAGMENT SHORTCODE function initDistortion() { if (document.querySelectorAll('.distortion__imgs').length) { $('.distortion__imgs').find('canvas').remove(); Array.from(document.querySelectorAll('.distortion__imgs')).forEach((el) => { const imgs = Array.from(el.querySelectorAll('img')); new hoverEffect({ parent: el, intensity: el.dataset.intensity || undefined, speedIn: el.dataset.speedin || undefined, speedOut: el.dataset.speedout || undefined, easing: el.dataset.easing || undefined, hover: el.dataset.hover || undefined, image1: imgs[0].getAttribute('src'), image2: imgs[1].getAttribute('src'), displacementImage: el.dataset.displacement }); }); } } function modernIsotopeHeight(){ if ($('.modern-animated .modern-animated-item').length && $(window).width() > 767) { $('.modern-animated .modern-animated-item').css('height', 'auto').equalHeights(); } else if ($('.modern-animated .modern-animated-item').length) { $('.modern-animated .modern-animated-item').css('height', 'auto'); } } function modernIsotope(){ if ($('.modern-animated').length) { var self = $('.modern-animated'); var layoutM = 'masonry'; self.isotope({ itemSelector: '.modern-animated-item', layoutMode: layoutM, masonry: { columnWidth: '.modern-animated-item' } }); } } function masonryIsotope(){ if ($('.masonry-animated').length) { var self = $('.masonry-animated'); var layoutM = 'masonry'; self.isotope({ itemSelector: '.masonry-animated-item', layoutMode: layoutM, masonry: { columnWidth: '.masonry-animated-item', 'gutter' : 30 }, }); } } function justified_gallery(){ if($('.justified-portfolio-wrap').length){ var image_height = $(window).height()/2.5; if($(window).width() < 992){ image_height = $(window).innerHeight()/3; } $('.justified-portfolio-wrap').justifiedGallery({ rowHeight : image_height, lastRow : 'justify', margins : 5 }); } } $(window).on('load resize orientationchange', function() { modernIsotopeHeight(); setTimeout(modernIsotope, 0); masonryIsotope(); }); $(window).on('load', function() { initDistortion(); justified_gallery(); }) })(jQuery, window, document);