new WOW().init();

(function ($) {
    "use strict";

    // Sticky nav
    $(window).scroll(function () {
        let scroll = $(window).scrollTop();

        if (scroll > 0) {
            $('.navbar-landing').addClass('navbar-fixed-landing');
        } else {
            $('.navbar-landing').removeClass('navbar-fixed-landing');
        }
    });

    // layout change and redirect
    $('.demo-type').on('click', (e)=> {
        e.preventDefault();
        let dataSet = e.currentTarget.dataset,
            context = dataSet.context,
            value = dataSet.value;
        if(context === 'theme') {
            localStorage.setItem('layout', 'ltr');
            localStorage.setItem('sidebarType', 'default');
        } else if (context === 'layout') {
            localStorage.setItem('theme', 'light');
            localStorage.setItem('sidebarType', 'default');
        } else if (context === 'sidebarType') {
            localStorage.setItem('theme', 'light');
            localStorage.setItem('layout', 'ltr');
        }
        localStorage.setItem(context, value);
        window.open('theme/index.html', '_blank');
    })

    $('.demo-type').on('mousedown', (e) => {
        e.preventDefault();
        let dataSet = e.currentTarget.dataset,
            context = dataSet.context,
            value = dataSet.value;
        if(context === 'theme') {
            localStorage.setItem('layout', 'ltr');
            localStorage.setItem('sidebarType', 'default');
        } else if (context === 'layout') {
            localStorage.setItem('theme', 'light');
            localStorage.setItem('sidebarType', 'default');
        } else if (context === 'sidebarType') {
            localStorage.setItem('theme', 'light');
            localStorage.setItem('layout', 'ltr');
        }
        localStorage.setItem(context, value);
    })

})(jQuery);
  