$(document).ready(function () {
    new WOW().init();
});

$(document).ready(function () {

    // ========= Goto Top button ===============
    var btn = $('.goto-top');
    $(window).scroll(function () {
        if ($(window).scrollTop() > 400) {
            btn.fadeIn();
        } else {
            btn.fadeOut();
        }
    });
    btn.on('click', function (e) {
        e.preventDefault();
        $('html, body').animate({scrollTop: 0}, 300);
    });


    // ========= tool tips ============
    $('[data-toggle="tooltip"]').tooltip();


});


// ========= aside-toggler =========
$(document).on('click','.aside-toggler', function () {
    $('.panel-aside').stop().toggleClass('expand-aside');
    $('.panel-body').stop().toggleClass('shirnk-body');
});

// ======= Aside / Body Content Controll ===========
var outerHeight = $('.doc-navbar').outerHeight();
var outerHeight = outerHeight+'px';

vh = 100+'vh';

$('.panel-aside').each(function () {
   $(this).css({
       height: 'calc(' + vh + ' - '+ outerHeight +')',
   });
});
$('.panel-body').each(function () {
    $(this).css({
        height: 'calc(' + vh + ' - '+ outerHeight +')',
    });
});


$('.aside-menu > li > a.nav-link').on('click', function () {
    var targetAttr = $(this).attr('href');
    $('.document-list > li').removeClass('active');
    $('.document-list li'+ targetAttr).addClass('active');

    $('.aside-menu > li').not($(this).parent('li')).removeClass('active');
    $(this).parent('li').addClass('active');
    $('.panel-aside').stop().toggleClass('expand-aside');
    $('.panel-body').stop().toggleClass('shirnk-body');
});


