Subversion Repositories SmartDukaan

Rev

Rev 27710 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
21627 kshitij.so 1
function initializeJS() {
2
 
3
    //tool tips
4
    jQuery('.tooltips').tooltip();
5
 
6
    //popovers
7
    jQuery('.popovers').popover();
8
 
9
    //custom scrollbar
10
        //for html
11
    jQuery("html").niceScroll({styler:"fb",cursorcolor:"#007AFF", cursorwidth: '6', cursorborderradius: '10px', background: '#F7F7F7', cursorborder: '', zindex: '1000'});
12
        //for sidebar
13
    jQuery("#sidebar").niceScroll({styler:"fb",cursorcolor:"#007AFF", cursorwidth: '3', cursorborderradius: '10px', background: '#F7F7F7', cursorborder: ''});
14
        // for scroll panel
15
    jQuery(".scroll-panel").niceScroll({styler:"fb",cursorcolor:"#007AFF", cursorwidth: '3', cursorborderradius: '10px', background: '#F7F7F7', cursorborder: ''});
16
 
17
    //sidebar dropdown menu
18
    jQuery('#sidebar .sub-menu > a').click(function () {
19
        var last = jQuery('.sub-menu.open', jQuery('#sidebar'));        
20
        jQuery('.menu-arrow').removeClass('arrow_carrot-right');
21
        jQuery('.sub', last).slideUp(200);
22
        var sub = jQuery(this).next();
23
        if (sub.is(":visible")) {
24
            jQuery('.menu-arrow').addClass('arrow_carrot-right');            
25
            sub.slideUp(200);
26
        } else {
27
            jQuery('.menu-arrow').addClass('arrow_carrot-down');            
28
            sub.slideDown(200);
29
        }
30
        var o = (jQuery(this).offset());
31
        diff = 200 - o.top;
32
        if(diff>0)
33
            jQuery("#sidebar").scrollTo("-="+Math.abs(diff),500);
34
        else
35
            jQuery("#sidebar").scrollTo("+="+Math.abs(diff),500);
36
    });
37
 
38
    // sidebar menu toggle
39
    jQuery(function() {
40
        function responsiveView() {
41
            var wSize = jQuery(window).width();
42
            if (wSize <= 768) {
43
                jQuery('#container').addClass('sidebar-close');
44
                jQuery('#sidebar > ul').hide();
45
            }
46
 
47
            if (wSize > 768) {
48
                jQuery('#container').removeClass('sidebar-close');
49
                jQuery('#sidebar > ul').show();
50
            }
51
        }
52
        jQuery(window).on('load', responsiveView);
53
        jQuery(window).on('resize', responsiveView);
54
    });
55
 
56
    jQuery('.toggle-nav').click(function () {
57
        if (jQuery('#sidebar > ul').is(":visible") === true) {
58
            jQuery('#main-content').css({
59
                'margin-left': '0px'
60
            });
61
            jQuery('#sidebar').css({
62
                'margin-left': '-180px'
63
            });
64
            jQuery('#sidebar > ul').hide();
65
            jQuery("#container").addClass("sidebar-closed");
66
        } else {
67
            jQuery('#main-content').css({
68
                'margin-left': '180px'
69
            });
70
            jQuery('#sidebar > ul').show();
71
            jQuery('#sidebar').css({
72
                'margin-left': '0'
73
            });
74
            jQuery("#container").removeClass("sidebar-closed");
75
        }
76
    });
77
 
78
    //bar chart
79
    if (jQuery(".custom-custom-bar-chart")) {
80
        jQuery(".bar").each(function () {
81
            var i = jQuery(this).find(".value").html();
82
            jQuery(this).find(".value").html("");
83
            jQuery(this).find(".value").animate({
84
                height: i
85
            }, 2000)
86
        })
87
    }
88
 
89
}
90
 
91
jQuery(document).ready(function(){
92
    initializeJS();
93
});