File: /var/www/vhosts/creativefellows.nl/nomor.creativefellows.nl/public/js/app.js
$(document).foundation().ready(function(){
$(".lazy-load-image").Lazy({
effect: "fadeIn",
effectTime : 500,
enableThrottle: true,
throttle: 250,
afterLoad: function(){
}
});
// css background image load
$(".lazy-load").each(function(i, el) {
if ($(el).visible(true)) {
$(el).removeClass("lazy-load").addClass("fade-in");
}
});
$(window).scroll(function(event) {
$(".lazy-load").each(function(i, el){
if ($(el).visible(true)) {
$(el).removeClass("lazy-load").addClass("lazy-load-complete fade-in");
}
});
});
$('.image-slider').slick({
centerMode: true,
centerPadding: '25%',
slidesToShow: 1,
infinite: true,
dots: false,
variableWidth: true,
responsive: [
{
breakpoint: 768,
settings: {
arrows: false,
dots: false,
centerMode: true,
centerPadding: '40px',
slidesToShow: 1,
variableWidth: false,
}
}
]
});
$('#acceptCookie').on("click",function(event)
{
event.preventDefault();
var cookies = $(this).closest(".cookies");
$.ajax({
type: 'POST',
url: "/accept-cookies",
complete: function (response) {
$("#cookies").slideUp("fast");
}
});
});
var $grid = $('#masonry-container').imagesLoaded( function() {
$grid.masonry({
itemSelector: '.grid-item',
});
});
});
$.fn.visible = function(partial) {
var $t = $(this),
$w = $(window),
viewTop = $w.scrollTop(),
viewBottom = viewTop + $w.height(),
_top = $t.offset().top,
_bottom = _top + $t.height(),
compareTop = partial === true ? _bottom : _top,
compareBottom = partial === true ? _top : _bottom;
return ((compareBottom <= viewBottom) && (compareTop >= viewTop));
};