/*
Theme Name: Consulting - Business Template
Theme URI: https://mdsumonmia.com/
Author URI: https://mdsumonmia.com/
*/
jQuery(document).ready(function($){
/*
Table Index
========================
1. Preloader
2. Responsive Menu
3. Slick Slider
*/
"use strict";
/*=====| 1. Preloader |=====*/
var loader = function() {
setTimeout(function() {
if($('#ftco-loader').length > 0) {
$('#ftco-loader').removeClass('show');
}
}, 1);
};
loader();
/*=====| Data Background |=====*/
$("[data-background").each(function(){
$(this).css("background-image","url("+$(this).attr("data-background") + ") ")
})
/*=====| sticky |=====*/
$(window).on('scroll', function () {
var scroll = $(window).scrollTop();
if (scroll < 245) {
$(".main-menu-area.sticky").removeClass("sticky-bar");
} else {
$(".main-menu-area.sticky").addClass("sticky-bar");
}
});
/*=====| 2. Responsive Menu |=====*/
// main menu
$('.main-menu-icon').click(function() {
$('.menu').toggleClass('menu-open');
$('.main-menu-icon').toggleClass('icon-cross');
$('.menu ul').slideToggle();
$('ul ul').css('display', 'none');
});
// Submenu
$('.menu ul li.has-children').click(function() {
$(this).find('ul').slideToggle();
$(this).siblings().find('ul').slideUp();
});
$(window).resize(function() {
if($(window).width() > 1210) {
$('ul').removeAttr('style');
}
});
/*=====| 1. Slick Slider |=====*/
// Hero Slider
$('.hero-slider').on('init', function(e, slick) {
var $firstAnimatingElements = $('div.hero-slides:first-child').find('[data-animation]');
doAnimations($firstAnimatingElements);
});
$('.hero-slider').on('beforeChange', function(e, slick, currentSlide, nextSlide) {
var $animatingElements = $('div.hero-slides[data-slick-index="' + nextSlide + '"]').find('[data-animation]');
doAnimations($animatingElements);
});
$('.hero-slider').slick({
autoplay: true,
autoplaySpeed: 10000,
dots: true,
slidesToShow: 1,
slidesToScroll: 1,
fade: true,
cssEase: 'linear',
prevArrow: '',
nextArrow: '',
});
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);
});
});
}
/* ==================================================
# Fun Factor Init
===============================================*/
$('.timer').countTo();
$('.fun-fact').appear(function() {
$('.timer').countTo();
}, {
accY: -100
});
// Testimonial JS
$('.feed-sldr').owlCarousel({
loop: true,
margin:30,
nav: true,
navText: [
"",
""
],
dots: false,
autoplay: true,
responsive: {
0: {
items: 1
},
600: {
items: 1
},
1000: {
items: 1
}
}
});
// Client Logo
// Testimonial JS
$('.client_logo_area').owlCarousel({
loop: true,
margin:30,
nav: true,
navText: [
"",
""
],
dots: false,
autoplay: true,
responsive: {
0: {
items: 2
},
600: {
items: 5
},
1000: {
items: 8
}
}
});
// Scroll to Top
$(window).on('scroll', function () {
var scroll = $(window).scrollTop();
if (scroll < 245) {
$("#scrtop").removeClass("scroll_top");
} else {
$("#scrtop").addClass("scroll_top");
}
});
// Sections Scroll
$('.smooth-scroll').on('click', function() {
event.preventDefault();
var sectionTo = $(this).attr('href');
$('html, body').stop().animate({
scrollTop: $(sectionTo).offset().top}, 1500, 'easeInOutExpo');
});
});
// Document.ready function end here