(function ($) {
"use strict";
// JS Index
//----------------------------------------
// 1. sticky menu
// 2. mobile-menu(mean-menu)
// 3. preloader
// 4. One Page Nav
// 5. mobile-menu-sidebar
// 6. background image
// 7. brand active
// 8. wow animation active
// 9. back top
// 10. parallax
//-------------------------------------------------
// 1. sticky menu
// ---------------------------------------------------------------------------
var wind = $(window);
var sticky = $("#header-sticky");
wind.on('scroll', function () {
var scroll = $(wind).scrollTop();
if (scroll < 2) {
sticky.removeClass("sticky-menu");
} else {
$("#header-sticky").addClass("sticky-menu");
}
});
// 2. mobile-menu(mean-menu)
//---------------------------------------------------------------------------
$("#mobile-menu").meanmenu({
meanMenuContainer: ".mobile-menu",
meanScreenWidth: "991",
});
// 3. preloader
//---------------------------------------------------------------------------
$(window).load(function(){
$('#preloader').fadeOut('slow',function(){$(this).remove();});
});
// 4. One Page Nav
//---------------------------------------------------------------------------
var top_offset = $('.header-area').height() - 10;
$('.main-menu nav ul').onePageNav({
currentClass: 'active',
scrollOffset: top_offset,
});
// 5. mobile-menu-sidebar
//---------------------------------------------------------------------------
$(".mobile-menubar").on("click", function(){
$(".side-mobile-menu").addClass('open-menubar');
$(".body-overlay").addClass("opened");
});
$(".close-icon").click(function(){
$(".side-mobile-menu").removeClass('open-menubar');
$(".body-overlay").removeClass("opened");
});
$(".body-overlay").on("click", function () {
$(".side-mobile-menu").removeClass('open-menubar');
$(".body-overlay").removeClass("opened");
});
// 6. background image
//---------------------------------------------------------------------------
$("[data-background]").each(function (){
$(this).css("background-image","url(" + $(this).attr("data-background") + ")");
});
// 7. brand active
//---------------------------------------------------------------------------
$('.testimonial-active').slick({
dots: false,
arrows: true,
prevArrow:'',
nextArrow:'',
infinite: true,
speed: 300,
slidesToShow: 1,
slidesToScroll: 1,
centerPadding: '30px',
responsive: [
{
breakpoint: 480,
settings: {
slidesToShow: 1,
}
}
]
});
// 8. wow animation active
// ---------------------------------------------------------------------------
new WOW().init();
// 9. back top
//---------------------------------------------------------------------------
$(window).on("scroll", function () {
$(window).scrollTop() > 350 ? $(".top").fadeIn(650) : $(".top").fadeOut(550);
}), $(".top").on("click", function () {
$("html,body").animate({
scrollTop: 0
});
});
// 10. parallax
// ---------------------------------------------------------------------------
var scene = $('#scene').get(0);
var parallax = new Parallax(scene, {
limitX: true,
scalarX: 10.0,
originX: 0,
});
})(jQuery);