mirror of
https://github.com/10h30/ycb.vn.git
synced 2026-06-05 15:10:02 +09:00
43 lines
976 B
JavaScript
43 lines
976 B
JavaScript
jQuery(function($){
|
|
$(window).load(function() {
|
|
|
|
// Main function.
|
|
function portfolioIsotope() {
|
|
var $container = $('.portfolio-content');
|
|
$container.isotope({
|
|
itemSelector: '.portfolio-item',
|
|
masonry: {
|
|
itemSelector: ".portfolio-item",
|
|
columnWidth: ".portfolio-item",
|
|
gutter: 20
|
|
}
|
|
});
|
|
} portfolioIsotope();
|
|
|
|
// Filter.
|
|
$('.filter a').click(function(){
|
|
var selector = $(this).attr('data-filter');
|
|
$('.portfolio-content').isotope({ filter: selector });
|
|
$(this).parent().find('a').removeClass('active');
|
|
$(this).addClass('active');
|
|
return false;
|
|
});
|
|
|
|
// Resize.
|
|
var isIE8 = $.browser.msie && +$.browser.version === 8;
|
|
if (isIE8) {
|
|
document.body.onresize = function () {
|
|
portfolioIsotope();
|
|
};
|
|
} else {
|
|
$(window).resize(function () {
|
|
portfolioIsotope();
|
|
});
|
|
}
|
|
|
|
// Orientation change.
|
|
window.addEventListener("orientationchange", function() {
|
|
portfolioIsotope();
|
|
});
|
|
});
|
|
}); |