(function ($) {
"use strict";
// One Page Nav
var top_offset = $('.transparent-header').height() - 0;
$('.main-menu nav ul').onePageNav({
currentClass: 'active',
scrollOffset: top_offset,
});
$(window).on('scroll', function () {
var scroll = $(window).scrollTop();
if (scroll < 245) {
$("#header-sticky").removeClass("sticky");
} else {
$("#header-sticky").addClass("sticky");
}
});
$('a.smoth-scroll').on('click', function (event) {
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top - 40
}, 1000);
event.preventDefault();
});
// data - background
$("[data-background]").each(function () {
$(this).css("background-image", "url(" + $(this).attr("data-background") + ")")
})
// menu toggle
$(".navbar-toggle").on("click", function () {
$(".navbar-nav").addClass("mobile_menu");
});
$(".navbar-nav li a").on("click", function () {
$(".navbar-collapse").removeClass("show");
});
// mainSlider
function mainSlider() {
var BasicSlider = $('.slider-active');
BasicSlider.on('init', function (e, slick) {
var $firstAnimatingElements = $('.single-slider:first-child').find('[data-animation]');
doAnimations($firstAnimatingElements);
});
BasicSlider.on('beforeChange', function (e, slick, currentSlide, nextSlide) {
var $animatingElements = $('.single-slider[data-slick-index="' + nextSlide + '"]').find('[data-animation]');
doAnimations($animatingElements);
});
BasicSlider.slick({
autoplay: false,
autoplaySpeed: 10000,
dots: false,
fade: true,
arrows: false,
responsive: [
{ breakpoint: 767, settings: { dots: false, arrows: false } }
]
});
function doAnimations(elements) {
var animationEndEvents = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
elements.each(function () {
var $this = $(this);
var $animationDelay = $this.data('delay');
var $animationType = 'animated ' + $this.data('animation');
$this.css({
'animation-delay': $animationDelay,
'-webkit-animation-delay': $animationDelay
});
$this.addClass($animationType).one(animationEndEvents, function () {
$this.removeClass($animationType);
});
});
}
}
mainSlider();
// awards-active
$('.awards-active').slick({
dots: false,
infinite: true,
speed: 2000,
slidesToShow: 5,
prevArrow:'',
nextArrow:'',
slidesToScroll: 1,
responsive: [
{
breakpoint: 1400,
settings: {
slidesToShow: 4,
slidesToScroll: 1,
infinite: true,
dots: false
}
},
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
infinite: true,
dots: false
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
arrows: false
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 2,
slidesToScroll: 2,
arrows: false
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
arrows: false
}
}
]
});
// brand-active
$('.brand-active').slick({
dots: false,
infinite: true,
speed: 2000,
arrows: false,
slidesToShow: 6,
prevArrow:'',
nextArrow:'',
slidesToScroll: 1,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 5,
slidesToScroll: 2,
dots: false
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 4,
slidesToScroll: 2
}
},
{
breakpoint: 766,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});
// blog-active
$('.blog-active').slick({
dots: false,
infinite: true,
arrows: true,
fade: true,
prevArrow: '',
nextArrow: '',
speed: 300,
slidesToShow: 1,
});
/* magnificPopup img view */
$('.popup-image').magnificPopup({
type: 'image',
gallery: {
enabled: true
}
});
/* magnificPopup video view */
$('.popup-video').magnificPopup({
type: 'iframe'
});
// scrollToTop
$.scrollUp({
scrollName: 'scrollUp', // Element ID
topDistance: '300', // Distance from top before showing element (px)
topSpeed: 300, // Speed back to top (ms)
animation: 'fade', // Fade, slide, none
animationInSpeed: 200, // Animation in speed (ms)
animationOutSpeed: 200, // Animation out speed (ms)
scrollText: '', // Text for element
activeOverlay: false, // Set CSS color to display scrollUp active point, e.g '#00FFFF'
});
// WOW active
new WOW().init();
})(jQuery);