/*-----------------------------------------------------------------------------------
/*
/* Init JS
/*
-----------------------------------------------------------------------------------*/
/*----------------------------------------------------*/
/* nav
/*----------------------------------------------------*/
$(function () {
var win = $(window);
// nav --------------------------------------------------------------------
$('header .nav-trigger').click(function () {
if ($('header').hasClass('active')) {
$('header').removeClass('active');
} else {
$('header').addClass('active');
}
});
if (win.width() > 1024) {
$('header .fullnav > li').bind({
mouseenter: function () {
$('header .depth_2, header .dim').stop().slideDown(200);
},
mouseleave: function () {
$('header .depth_2, header .dim').stop().slideUp(200);
}
});
} else {
$('.fullnav > li > a').each(function () {
var link = $(this).attr('href');
$(this).attr('data_link', link);
$(this).removeAttr('href');
});
}
win.resize(function () {
if (win.width() > 1024) {
$('header .fullnav > li').bind({
mouseenter: function () {
$('header .depth_2, header .dim').stop().slideDown(200);
},
mouseleave: function () {
$('header .depth_2, header .dim').stop().slideUp(200);
}
});
$('.fullnav > li > a').each(function () {
var link = $(this).attr('data_link');
$(this).attr('href', link);
$(this).removeAttr('data_link');
});
$('header .depth_2, header .dim').removeAttr('style');
} else {
$('header .fullnav > li').unbind('mouseenter');
$('header .fullnav > li').unbind('mouseleave');
$('.fullnav > li > a').each(function () {
var link = $(this).attr('href');
$(this).attr('data_link', link);
$(this).removeAttr('href');
});
}
});
});
function mobile_navi(_target) {
var _target = $(_target);
if (_target.parent().hasClass('active')) {
_target.parent().removeClass('active');
_target.siblings().slideUp(200);
} else {
$('.fullnav > li').removeClass('active');
$('.fullnav .depth_2').slideUp(200);
_target.parent().addClass('active');
_target.siblings().slideDown(200);
}
}
jQuery(document).ready(function () {
$WIN = $(window);
/* Preloader
* -------------------------------------------------- */
var Preloader = function () {
$WIN.on('load', function () {
// will first fade out the loading animation
$("#loader").fadeOut("slow", function () {
// will fade out the whole DIV that covers the website.
$("#preloader").delay(300).fadeOut("slow");
});
});
};
/*----------------------------------------------------*/
/* imagesLoaded
/*----------------------------------------------------*/
$('body').imagesLoaded()
.always( function( instance ) {
console.log('all images loaded');
})
.done( function( instance ) {
console.log('all images successfully loaded');
})
.fail( function() {
console.log('all images loaded, at least one is broken');
})
.progress( function( instance, image ) {
var result = image.isLoaded ? 'loaded' : 'broken';
console.log( 'image is ' + result + ' for ' + image.img.src );
});
// background
$('#intro').imagesLoaded({
background: '.img-fill'
}, function () {
console.log('all .img-fill background images loaded');
});
/*----------------------------------------------------*/
/* slider
/*----------------------------------------------------*/
// Slider Options
$(".id-Slider").slick({
autoplay: true,
autoplaySpeed: 5000,
speed: 600,
slidesToShow: 1,
slidesToScroll: 1,
pauseOnHover: true,
dots: true,
pauseOnDotsHover: true,
cssEase: 'linear',
fade: true,
draggable: true,
prevArrow: '',
nextArrow: '',
// Custom Dots With Thumbnails Tool Tip
customPaging: function (slider, i) {
var thumbnail = $(slider.$slides[i]).data('thumbnail');
return '';
},
});
$('.customer-logos').slick({
slidesToShow: 6,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 1500,
arrows: false,
dots: false,
pauseOnHover: false,
responsive: [{
breakpoint: 768,
settings: {
slidesToShow: 4
}
}, {
breakpoint: 480,
settings: {
slidesToScroll: 2,
slidesToShow: 2
}
}]
});
//------- Custom Arrows click functionality
$(document).on('click', '.prevSlide', function () {
$('.customer-logos').slick('slickPrev');
});
$(document).on('click', '.nextSlide', function () {
$('.customer-logos').slick('slickNext');
});
/* Smooth Scrolling
* ------------------------------------------------------ */
$('.smoothscroll').on('click', function (e) {
e.preventDefault();
var target = this.hash,
$target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 800, 'swing', function () {
window.location.hash = target;
});
});
/* Back to Top
* ------------------------------------------------------ */
// declare variable
var scrollTop = $(".scrollTop");
$(window).scroll(function () {
// declare variable
var topPos = $(this).scrollTop();
// if user scrolls down - show scroll to top button
if (topPos > 100) {
$(scrollTop).css("opacity", "1");
} else {
$(scrollTop).css("opacity", "0");
}
}); // scroll END
//Click event to scroll to top
$(scrollTop).click(function () {
$('html, body').animate({
scrollTop: 0
}, 300);
return false;
}); // click() scroll top EMD
/* Initialize
* ------------------------------------------------------ */
(function ssInit() {
Preloader();
})();
});
(jQuery);