Subversion Repositories SmartDukaan

Rev

Rev 27710 | Blame | Compare with Previous | Last modification | View Log | RSS feed

function initializeJS() {

    jQuery('.tooltips').tooltip();

    jQuery('#sidebar .sub-menu > a').click(function () {
        var last = jQuery('.sub-menu.open', jQuery('#sidebar'));
        jQuery('.menu-arrow').removeClass('arrow_carrot-right');
        jQuery('.sub', last).slideUp(200);
        var sub = jQuery(this).next();
        if (sub.is(":visible")) {
            jQuery('.menu-arrow').addClass('arrow_carrot-right');
            sub.slideUp(200);
        } else {
            jQuery('.menu-arrow').addClass('arrow_carrot-down');
            sub.slideDown(200);
        }
    });

    jQuery('.toggle-nav').click(function () {
        jQuery('#container').toggleClass('sidebar-closed');
    });

    var resizeTimer;
    function responsiveView() {
        var wSize = jQuery(window).width();
        if (wSize <= 768) {
            jQuery('#container').addClass('sidebar-closed');
        } else {
            jQuery('#container').removeClass('sidebar-closed');
        }
    }
    jQuery(window).on('load', responsiveView);
    jQuery(window).on('resize', function () {
        clearTimeout(resizeTimer);
        resizeTimer = setTimeout(responsiveView, 150);
    });
}

jQuery(document).ready(function () {
    initializeJS();
});