index.js 813 Bytes
/**
 * index
 * 默认依赖
 */
'use strict';

var $ = require('jquery');
require('yoho.bootstrap');


/*左侧导航*/
$('.leftpanel .nav .parent>a').click(function() {
    var coll = $(this).parents('.collapsed').length,
        child = $(this).parent().find('.children');
      
    if (!coll) {
        $('.leftpanel .nav .parent-focus').each(function() {
            $(this).find('.children').slideUp('fast');
            $(this).removeClass('parent-focus');
        });
         
        if(!child.is(':visible')) {
            child.slideDown('fast');
            if(!child.parent().hasClass('active'))
               child.parent().addClass('parent-focus');
        } else {
            child.slideUp('fast');
            child.parent().removeClass('parent-focus');
        }
    }
    return false;
});