
PK 
/* Portfolio Sorting */
jQuery(document).ready(function () {
(function ($) {
var container = $('section.portfolio_container');
function getNumbColumns() {
var winWidth = $(window).width(),
columnNumb = 1;
if (winWidth > 1500) {
columnNumb = 6;
} else if (winWidth > 1200) {
columnNumb = 5;
} else if (winWidth > 900) {
columnNumb = 4;
} else if (winWidth > 600) {
columnNumb = 3;
} else if (winWidth > 300) {
columnNumb = 2;
}
return columnNumb;
}
function setColumnWidth() {
var winWidth = $(window).width(),
columnNumb = getNumbColumns(),
postWidth = Math.floor(winWidth / columnNumb);
container.find('.portfolio').each(function () {
$(this).css( {
width : postWidth + 'px'
});
});
}
$('.gallerySelector .gallerySelectorList a').click(function () {
var selector = $(this).attr('data-filter');
$(this).parent().parent().find('> li.current').removeClass('current');
$(this).parent().addClass('current');
container.isotope( {
filter : selector
});
setTimeout(function () {
reArrangeProjects();
}, 300);
return false;
});
function reArrangeProjects() {
setColumnWidth();
container.isotope('reLayout');
}
container.imagesLoaded(function () {
setColumnWidth();
container.isotope( {
itemSelector : 'article.portfolio',
layoutMode : 'masonry',
resizable : false
} );
} );
$(window).on('debouncedresize', function () {
reArrangeProjects();
} );
} )(jQuery);
} );
/* DebouncedResize Function */
(function ($) {
var $event = $.event,
$special,
resizeTimeout;
$special = $event.special.debouncedresize = {
setup : function () {
$(this).on('resize', $special.handler);
},
teardown : function () {
$(this).off('resize', $special.handler);
},
handler : function (event, execAsap) {
var context = this,
args = arguments,
dispatch = function () {
event.type = 'debouncedresize';
$event.dispatch.apply(context, args);
};
if (resizeTimeout) {
clearTimeout(resizeTimeout);
}
execAsap ? dispatch() : resizeTimeout = setTimeout(dispatch, $special.threshold);
},
threshold : 150
};
} )(jQuery);


PK 99