aboutsummaryrefslogtreecommitdiffstats
path: root/app/assets/javascripts/banners/banners.js
blob: 9fcea064b5834977bea77cc3608fdae70b45493e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$(function() {
    $(document).ready(function() {
        $(".tree ul:first > li:first").addClass("branch_start");
        $('.tree  ul').find('li:last').addClass("branch_end");
        $('ul.tristate').tristate();

        $('.tree').delegate('.toggle','click', function(e) {
            e.preventDefault();

            var $li   = $(this).parents('li:first');
            var $icon = $li.find('.icon.toggle');
            var $nested = $li.find('.nested');

            if ($icon.hasClass('expanded')) {
                $icon.removeClass('expanded');
                $nested.slideUp();
            }
            else {
                $icon.addClass('expanded');
                $nested.slideDown();
            }

        });
    });
});