gcg-website/themes/educenter-hugo/assets/js/script.js

124 lines
3.0 KiB
JavaScript
Raw Normal View History

2020-06-27 10:05:59 +02:00
(function ($) {
'use strict';
2020-08-11 14:10:42 +02:00
// Preloader js
2020-06-27 10:05:59 +02:00
$(window).on('load', function () {
$('.preloader').fadeOut(100);
});
// Sticky Menu
$(window).scroll(function () {
var height = $('.top-header').innerHeight();
if ($('header').offset().top > 10) {
$('.top-header').addClass('hide');
$('.navigation').addClass('nav-bg');
$('.navigation').css('margin-top','-'+height+'px');
} else {
$('.top-header').removeClass('hide');
$('.navigation').removeClass('nav-bg');
$('.navigation').css('margin-top','-'+0+'px');
}
});
2020-08-11 14:10:42 +02:00
2020-06-27 10:05:59 +02:00
2020-08-11 15:20:41 +02:00
// Background-media
2020-06-27 10:05:59 +02:00
$('[data-background]').each(function () {
$(this).css({
'background-image': 'url(' + $(this).data('background') + ')'
});
});
//Hero Slider
$('.hero-slider').slick({
autoplay: true,
autoplaySpeed: 7500,
pauseOnFocus: false,
pauseOnHover: false,
infinite: true,
arrows: true,
fade: true,
prevArrow: '<button type=\'button\' class=\'prevArrow\'><i class=\'ti-angle-left\'></i></button>',
nextArrow: '<button type=\'button\' class=\'nextArrow\'><i class=\'ti-angle-right\'></i></button>',
dots: true
});
$('.hero-slider').slickAnimation();
// venobox popup
$(document).ready(function () {
$('.venobox').venobox();
});
// filter
$(document).ready(function () {
var containerEl = document.querySelector('.filtr-container');
var filterizd;
if (containerEl) {
filterizd = $('.filtr-container').filterizr({});
}
//Active changer
$('.filter-controls li').on('click', function () {
$('.filter-controls li').removeClass('active');
$(this).addClass('active');
});
});
// Count Up
function counter() {
var oTop;
if ($('.count').length !== 0) {
oTop = $('.count').offset().top - window.innerHeight;
}
if ($(window).scrollTop() > oTop) {
$('.count').each(function () {
var $this = $(this),
countTo = $this.attr('data-count');
$({
countNum: $this.text()
}).animate({
countNum: countTo
}, {
duration: 1000,
easing: 'swing',
step: function () {
$this.text(Math.floor(this.countNum));
},
complete: function () {
$this.text(this.countNum);
}
});
});
}
}
$(window).on('scroll', function () {
counter();
});
// Animation
$(document).ready(function () {
$('.has-animation').each(function (index) {
$(this).delay($(this).data('delay')).queue(function () {
$(this).addClass('animate-in');
});
});
});
2020-08-11 14:10:42 +02:00
var containerEl = document.querySelector('.shuffle-wrapper');
if (containerEl) {
var Shuffle = window.Shuffle;
var myShuffle = new Shuffle(document.querySelector('.shuffle-wrapper'), {
itemSelector: '.shuffle-item',
buffer: 1
});
jQuery('input[name="shuffle-filter"]').on('change', function (evt) {
var input = evt.currentTarget;
if (input.checked) {
myShuffle.filter(input.value);
}
});
}
2020-06-27 10:05:59 +02:00
2020-08-11 14:10:42 +02:00
})(jQuery);