$(".anchor").click(function() {
    var target = this.hash;
    var $target = $(target);
    $('html, body').animate({
        scrollTop: $(target).offset().top
    }, 1000);
});



$(window).scroll(function() {    
    var scroll = $(window).scrollTop();

    if (scroll >= 250) {
        $(".navbar").addClass("darkHeader");
    } else {
        $(".navbar").removeClass("darkHeader");
    }
});

//-----------wow-animation-start
new WOW().init();
//-----------wow-animation-end


//-----------For active class on topnav -start
var header = document.getElementById("topnav");
var navs = header.getElementsByClassName("nav-item");
for (var i = 0; i < navs.length; i++) {
  navs[i].addEventListener("click", function() {
  var current = document.getElementsByClassName("active");
  if (current.length > 0) { 
    current[0].className = current[0].className.replace(" active", "");
  }
  this.className += " active";
  });
}
//-----------For active class on topnav - end

//-----------For close navbar on click - start
$('.navbar-nav>li>a').on('click', function(){
    $('.navbar-collapse').collapse('hide');
});
//-----------For close navbar on click - end

//-----------loader - start
document.onreadystatechange = function () {
    var state = document.readyState
    if (state == 'interactive') {
            document.getElementById('contents').style.visibility="hidden";
    } else if (state == 'complete') {
        setTimeout(function(){
            document.getElementById('interactive');
            document.getElementById('load').style.visibility="hidden";
            document.getElementById('contents').style.visibility="visible";
        },1000);
    }
}
//-----------loader - end