/***************************************************
==================== js index ======================
****************************************************
01. preloader js
02. mobile menu js
03. search js
04. sticky header js
05. data-background js
06. scroll to top js
07. hero slider js
08. testimonial js
09. brand slider js
10. testimonial slider js
11. project slider js
12. masonary js
13. wow js
14. counter js
15. inhover active js
16. parallax js
****************************************************/
(function ($) {
"use strict";
var windowon = $(window);
////////////////////////////////////////////////////
// 01. preloader js
windowon.on('load',function() {
$("#loading").fadeout(500);
});
////////////////////////////////////////////////////
// 02. mobile menu js
$('#mobile-menu').meanmenu({
meanmenucontainer: '.mobile-menu',
meanscreenwidth: "991",
meanexpand: [''],
});
////////////////////////////////////////////////////
// 03. search js
$("#sidebar-toggle").on("click", function () {
$(".sidebar__area").addclass("sidebar-opened");
$(".body-overlay").addclass("opened");
});
$(".sidebar__close-btn").on("click", function () {
$(".sidebar__area").removeclass("sidebar-opened");
$(".body-overlay").removeclass("opened");
});
$(".body-overlay").on("click", function () {
$(".sidebar__area").removeclass("sidebar-opened");
$(".body-overlay").removeclass("opened");
});
$(".body-overlay-2").on("click", function () {
$(".header__search-wrapper").removeclass("opened");
$(".search-toggle i").removeclass("fa-times");
$(".body-overlay-2").removeclass("opened");
});
let searchtogglestatus = false;
$(".search-toggle").on("click", function () {
if (searchtogglestatus === false){
$(".header__search-wrapper").addclass("opened");
$(".search-toggle i").addclass("fa-times");
$(".body-overlay-2").addclass("opened");
searchtogglestatus = true;
}
else if (searchtogglestatus === true) {
$(".header__search-wrapper").removeclass("opened");
$(".search-toggle i").removeclass("fa-times");
$(".body-overlay-2").removeclass("opened");
searchtogglestatus = false;
}
});
////////////////////////////////////////////////////
// 04. sticky header js
windowon.on('scroll', function () {
var scroll = $(window).scrolltop();
if (scroll < 100) {
$("#header__sticky").removeclass("sticky");
} else {
$("#header__sticky").addclass("sticky");
}
});
////////////////////////////////////////////////////
// 05. data-background js
$("[data-background").each(function () {
$(this).css("background-image", "url( " + $(this).attr("data-background") + " )");
});
////////////////////////////////////////////////////
// 06. scroll to top js
function smoothsctolltop() {
$('.smooth-scroll a').on('click', function (event) {
var target = $(this.getattribute('href'));
if (target.length) {
event.preventdefault();
$('html, body').stop().animate({
scrolltop: target.offset().top - 0
}, 1500);
}
});
}
smoothsctolltop();
// show or hide the sticky footer button
windowon.on('scroll', function(event) {
if($(this).scrolltop() > 600){
$('#scroll').fadein(200)
} else{
$('#scroll').fadeout(200)
}
});
//animate the scroll to yop
$('#scroll').on('click', function(event) {
event.preventdefault();
$('html, body').animate({
scrolltop: 0,
}, 1500);
});
////////////////////////////////////////////////////
// 07. hero slider js
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: true,
autoplayspeed: 8000,
dots: false,
fade: true,
arrows: false,
prevarrow: '',
nextarrow: '',
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();
////////////////////////////////////////////////////
// 08. testimonial js
$('.testimonial__wrapper').slick({
slidestoshow: 1,
slidestoscroll: 1,
arrows: false,
fade: true,
dots: true,
asnavfor: '.testimonial__nav',
});
$('.testimonial__nav').slick({
slidestoshow: 3,
slidestoscroll: 1,
asnavfor: '.testimonial__wrapper',
dots: false,
centermode: true,
centerpadding: 0,
focusonselect: true,
arrows: false,
prevarrow: '',
nextarrow: '',
responsive: [
{
breakpoint: 576,
settings: {
slidestoshow: 1,
slidestoscroll: 1
}
}
]
});
////////////////////////////////////////////////////
// 09. brand slider js
$('.brand__slider ').owlcarousel({
loop:true,
margin:30,
autoplay:false,
autoplaytimeout:3000,
smartspeed:500,
items:6,
navtext:['',''],
nav:false,
dots:false,
responsive:{
0:{
items:1
},
576:{
items:2
},
767:{
items:2
},
992:{
items:3
},
1200:{
items:4
},
1600:{
items:4
}
}
});
////////////////////////////////////////////////////
// 10. testimonial slider js
$('.testimonial__slider').owlcarousel({
loop:true,
margin:30,
autoplay:false,
autoplaytimeout:3000,
smartspeed:500,
items:6,
navtext:['',''],
nav:false,
dots:true,
responsive:{
0:{
items:1
},
576:{
items:1
},
767:{
items:1
},
992:{
items:1
},
1200:{
items:1
},
1600:{
items:1
}
}
});
////////////////////////////////////////////////////
// 11. project slider js
$('.project__slider').owlcarousel({
loop:true,
margin:30,
autoplay:false,
autoplaytimeout:3000,
smartspeed:500,
items:6,
navtext:['',''],
nav:false,
dots:true,
responsive:{
0:{
items:1
},
576:{
items:1
},
767:{
items:2
},
992:{
items:2
},
1200:{
items:2
},
1600:{
items:2
}
}
});
////////////////////////////////////////////////////
// 12. masonary js
$('.grid').imagesloaded( function() {
// init isotope
var $grid = $('.grid').isotope({
itemselector: '.grid-item',
percentposition: true,
masonry: {
// use outer width of grid-sizer for columnwidth
columnwidth: 1
}
});
// filter items on button click
$('.masonary-menu').on( 'click', 'button', function() {
var filtervalue = $(this).attr('data-filter');
$grid.isotope({ filter: filtervalue });
});
//for menu active class
$('.masonary-menu button').on('click', function(event) {
$(this).siblings('.active').removeclass('active');
$(this).addclass('active');
event.preventdefault();
});
});
////////////////////////////////////////////////////
// 13. wow js
////////////////////////////////////////////////////
// 14. counter js
////////////////////////////////////////////////////
// 15. inhover active js
$('.price__item').on('mouseenter', function () {
$(this).addclass('active').parent().siblings().find('.price__item').removeclass('active');
});
////////////////////////////////////////////////////
// 16. parallax js
if ($('.scene').length > 0 ) {
$('.scene').parallax({
scalarx: 10.0,
scalary: 15.0,
});
}
})(jquery);