$(window).on('load' , function () {
    
    $('.loader').fadeOut(1000);
    
    new WOW().init();
    
    $('body').addClass('o-auto');
    
})

$(document).ready(function () { 
	var dir = $('html').attr('dir');
    $('.default').on('click', function(e) {
        e.preventDefault();
    });
    $( ".top-nav  a" ).addClass( "page-scroll" );

    $('.overlay').fadeOut();
    
    $(".mob-collaps").on('click', function() {
        $(this).parent().find(".nav-links > ul").toggleClass('nav-open');

        $('.overlay').fadeToggle();

        $(this).find("span:first-child").toggleClass('rotate');
        $(this).find("span:nth-child(2)").toggleClass('none');
        $(this).find("span:nth-child(3)").toggleClass('rotate2');
    });

    $(".overlay").on('click', function() {
        $(".nav-links ul").removeClass('nav-open');
        $(this).fadeOut();

        $(".mob-collaps span:first-child").removeClass('rotate');
        $(".mob-collaps span:nth-child(2)").removeClass('none');
        $(".mob-collaps span:nth-child(3)").removeClass('rotate2');
    });

  
    $(".nav-links ul a").on('click', function() {
        $(".nav-links ul").removeClass('nav-open');
        $(".overlay").fadeOut();

        $(".mob-collaps span:first-child").removeClass('rotate');
        $(".mob-collaps span:nth-child(2)").removeClass('none');
        $(".mob-collaps span:nth-child(3)").removeClass('rotate2');
    });
    $(".top-nav a").each(
        function() {
            if (window.location.href.includes($(this).attr('href'))) {
                $(this).parents('li ').addClass("active");
             }
        }
    );


   $('.header-slider ').owlCarousel({
            
    margin: 0,
    autoplay: false,
    loop: true,
    rtl:(dir == 'rtl')?true:false,
//     animateIn: 'fadeInRight',
//     animateOut: 'fadeInLeft ',
    nav: true,
    navText: (dir == 'rtl')?['<div><i class="fa fa-angle-right" aria-hidden="true"></i></div>', '<div><i class="fa fa-angle-left" aria-hidden="true"></i></div>']:['<div><i class="fa fa-angle-right" aria-hidden="true"></i></div>', '<div><i class="fa fa-angle-left" aria-hidden="true"></i></div>'],
    dots:true,
 
     responsive: {
    0: {
    items: 1
    },
    600: {
    items: 1
    },
    1000: {
    items: 1
    }
    }
    });
   
        $('.brand-slider ').owlCarousel({
            
            margin: 20,
            autoplay: true,
            loop: true,
            nav: false,
             dots:false,
         
             responsive: {
            0: {
            items: 1
            },
            600: {
            items: 2
            },
            1000: {
            items: 6
            }
            }
            });
        

    $(function () {
        $('[data-toggle="tooltip"]').tooltip()
      });
    
      $("nav.navbar li a[data-value]").click(function () {
        $("html , body").animate({
            scrollTop: $("#" + $(this).data("value")).offset().top - 50
        }, 1000);

        $(this).parent().addClass("active").siblings().removeClass("active");
        event.preventDefault();
    });

    
  $('a.page-scroll').click(function () {
    if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
        var target = $(this.hash);
        target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
        if (target.length) {
            $('html,body').animate({
                scrollTop: target.offset().top - 40
            }, 900);
            return false;
        }
    }
    });
    
  
    
});
 

 