maj
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,51 @@
|
||||
/* -- Filter Plugin -- */
|
||||
(function ($) {
|
||||
'use strict';
|
||||
$.fn.masonryFilter = function (options) {
|
||||
//reload masonry
|
||||
var reload = function ($container) {
|
||||
setTimeout(function () {
|
||||
$container.masonry("layout");
|
||||
}, 100);
|
||||
};
|
||||
|
||||
var process = function ($container) {
|
||||
var items = $container.masonry("getAllItems"),
|
||||
revealItems = [],
|
||||
hideItems = [];
|
||||
|
||||
$.each(items, function(i) {
|
||||
var item = items[i];
|
||||
var elm = $(item.element),
|
||||
shouldShow = options.filter && options.filter.call(elm);
|
||||
|
||||
if (shouldShow) {
|
||||
if (item.isHidden) {
|
||||
// -- Have to set this property so masonry does
|
||||
// not include hidden items when calling "layout"
|
||||
item.isIgnored = false;
|
||||
revealItems.push(item);
|
||||
}
|
||||
} else {
|
||||
if (!item.isHidden) {
|
||||
// -- Easier to set this property directy rather than
|
||||
// using the "ignore" method, as it takes in a DOM
|
||||
// element rather than the masonry item object.
|
||||
item.isIgnored = true;
|
||||
hideItems.push(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$container.masonry('hide', hideItems);
|
||||
$container.masonry('reveal', revealItems);
|
||||
|
||||
reload($container);
|
||||
};
|
||||
|
||||
return this.each(function () {
|
||||
var self = $(this);
|
||||
process(self);
|
||||
});
|
||||
};
|
||||
}(window.jQuery));
|
||||
+2905
-3
File diff suppressed because one or more lines are too long
@@ -4,35 +4,53 @@ var $cat = $('.cat-list .cat a');
|
||||
var $img = $('.item #items .img');
|
||||
|
||||
function masonry() {
|
||||
var $grid = $cards.masonry({
|
||||
itemSelector: '.card',
|
||||
columnWidth: '.card',
|
||||
percentPosition: true,
|
||||
gutter: 10,
|
||||
transitionDuration: '0.2s'
|
||||
});
|
||||
var $grid2 = $img.masonry({
|
||||
itemSelector: '.img-card',
|
||||
columnWidth: '.img-card',
|
||||
percentPosition: true,
|
||||
gutter: 10,
|
||||
transitionDuration: '0.2s'
|
||||
});
|
||||
$grid.imagesLoaded().progress(function() {
|
||||
$grid.masonry();
|
||||
});
|
||||
$grid2.imagesLoaded().progress(function() {
|
||||
$grid2.masonry();
|
||||
var $grid = $cards.masonry({
|
||||
itemSelector: '.card',
|
||||
columnWidth: '.card',
|
||||
percentPosition: true,
|
||||
gutter: 10,
|
||||
isAnimated: true,
|
||||
transitionDuration: '0.5s'
|
||||
});
|
||||
|
||||
var $grid2 = $img.masonry({
|
||||
itemSelector: '.img-card',
|
||||
columnWidth: '.img-card',
|
||||
percentPosition: true,
|
||||
gutter: 10,
|
||||
transitionDuration: '0.2s'
|
||||
});
|
||||
|
||||
$(".cat-list .btn a").click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$('.active').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
|
||||
var filter = $(this).attr("data-filter");
|
||||
var self = $('#body-wrapper #items .full-works');
|
||||
|
||||
self.masonryFilter({
|
||||
filter: function () {
|
||||
if (!filter) return true;
|
||||
return $(this).attr("data-filter") == filter;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$grid.imagesLoaded().progress(function() {
|
||||
$grid.masonry();
|
||||
});
|
||||
|
||||
$grid2.imagesLoaded().progress(function() {
|
||||
$grid2.masonry();
|
||||
});
|
||||
}
|
||||
|
||||
function filteritem() {
|
||||
var $container = $('#masonryContainer');
|
||||
|
||||
$cards.multipleFilterMasonry({
|
||||
itemSelector: '.card',
|
||||
filtersGroupSelector: '.cat-list'
|
||||
});
|
||||
var $card = $('#body > .card');
|
||||
var $cat = $('.cat a');
|
||||
var $img = $('#body .img');
|
||||
}
|
||||
|
||||
function contact() {
|
||||
@@ -49,41 +67,41 @@ function contact() {
|
||||
})
|
||||
}
|
||||
|
||||
function customscroll() {
|
||||
var $page = $('#page-wrapper.blog')
|
||||
function customscroll($page_item) {
|
||||
var $page = $('#page-wrapper.blog');
|
||||
var $page_item = $("body.blog #start, body.item");
|
||||
|
||||
$("body").mCustomScrollbar({
|
||||
theme: "dark",
|
||||
scrollbarPosition: "outside",
|
||||
callbacks: {
|
||||
whileScrolling: function() {
|
||||
var pct = this.mcs.topPct;
|
||||
if (pct < 1) {
|
||||
$page.addClass("up");
|
||||
$page.removeClass("down");
|
||||
} else {
|
||||
$page.removeClass("up");
|
||||
$page.addClass("down")
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$page_item.mCustomScrollbar({
|
||||
theme: "dark",
|
||||
scrollbarPosition: "outside",
|
||||
scrollInertia: 1000,
|
||||
callbacks: {
|
||||
onInit: function(){
|
||||
$('.top').on('click', function() {
|
||||
event.preventDefault()
|
||||
$page_item.mCustomScrollbar('scrollTo',['top',null]);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function scrolltop() {
|
||||
var $top = $('.top');
|
||||
|
||||
$top.on('click', function(e) {
|
||||
// e.preventDefault()
|
||||
|
||||
})
|
||||
$("body").mCustomScrollbar({
|
||||
theme: "dark",
|
||||
scrollbarPosition: "outside",
|
||||
callbacks: {
|
||||
whileScrolling: function() {
|
||||
var pct = this.mcs.topPct;
|
||||
if (pct < 1) {
|
||||
} else {
|
||||
$page.addClass("down");
|
||||
$page_item.mCustomScrollbar("disable",true);
|
||||
}
|
||||
setTimeout(function(){
|
||||
$page_item.mCustomScrollbar("update");
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
@@ -91,10 +109,5 @@ jQuery(document).ready(function($) {
|
||||
filteritem();
|
||||
contact();
|
||||
customscroll();
|
||||
// scrolltop();
|
||||
|
||||
// $(window).load(function() {
|
||||
// $('html, body').scrollTop(0);
|
||||
// });
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user