Subversion Repositories SmartDukaan

Rev

Rev 27710 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27710 Rev 36566
Line 1... Line -...
1
function initializeJS() {
-
 
2
 
-
 
3
    //tool tips
-
 
4
    jQuery('.tooltips').tooltip();
-
 
5
 
-
 
6
    jQuery("#sidebar").niceScroll({styler:"fb",cursorcolor:"#007AFF", cursorwidth: '3', cursorborderradius: '10px', background: '#F7F7F7', cursorborder: ''});
-
 
7
    
-
 
8
    //sidebar dropdown menu
-
 
9
    jQuery('#sidebar .sub-menu > a').click(function () {
-
 
10
        var last = jQuery('.sub-menu.open', jQuery('#sidebar'));        
-
 
11
        jQuery('.menu-arrow').removeClass('arrow_carrot-right');
-
 
12
        jQuery('.sub', last).slideUp(200);
-
 
13
        var sub = jQuery(this).next();
-
 
14
        if (sub.is(":visible")) {
-
 
15
            jQuery('.menu-arrow').addClass('arrow_carrot-right');            
-
 
16
            sub.slideUp(200);
-
 
17
        } else {
-
 
18
            jQuery('.menu-arrow').addClass('arrow_carrot-down');            
-
 
19
            sub.slideDown(200);
-
 
20
        }
-
 
21
        var o = (jQuery(this).offset());
-
 
22
        diff = 200 - o.top;
-
 
23
        if(diff>0)
-
 
24
            jQuery("#sidebar").scrollTo("-="+Math.abs(diff),500);
-
 
25
        else
-
 
26
            jQuery("#sidebar").scrollTo("+="+Math.abs(diff),500);
-
 
27
    });
-
 
28
 
-
 
29
    // sidebar menu toggle
-
 
30
    jQuery(function() {
-
 
31
        function responsiveView() {
-
 
32
            var wSize = jQuery(window).width();
-
 
33
            if (wSize <= 768) {
-
 
34
                jQuery('#container').addClass('sidebar-close');
-
 
35
                jQuery('#sidebar > ul').hide();
-
 
36
            }
-
 
37
 
-
 
38
            if (wSize > 768) {
-
 
39
                jQuery('#container').removeClass('sidebar-close');
-
 
40
                jQuery('#sidebar > ul').show();
-
 
41
            }
-
 
42
        }
-
 
43
        jQuery(window).on('load', responsiveView);
-
 
44
        jQuery(window).on('resize', responsiveView);
-
 
45
    });
-
 
46
 
-
 
47
    jQuery('.toggle-nav').click(function () {
-
 
48
        if (jQuery('#sidebar > ul').is(":visible") === true) {
-
 
49
            jQuery('#main-content').css({
-
 
50
                'margin-left': '0px'
-
 
51
            });
-
 
52
            jQuery('#sidebar').css({
-
 
53
                'margin-left': '-180px'
-
 
54
            });
-
 
55
            jQuery('#sidebar > ul').hide();
-
 
56
            jQuery("#container").addClass("sidebar-closed");
-
 
57
        } else {
-
 
58
            jQuery('#main-content').css({
-
 
59
                'margin-left': '180px'
-
 
60
            });
-
 
61
            jQuery('#sidebar > ul').show();
-
 
62
            jQuery('#sidebar').css({
-
 
63
                'margin-left': '0'
-
 
64
            });
-
 
65
            jQuery("#container").removeClass("sidebar-closed");
-
 
66
        }
-
 
67
    });
-
 
68
}
-
 
69
 
-
 
70
jQuery(document).ready(function(){
-
 
71
    initializeJS();
-
 
72
});
-
 
73
1
function initializeJS() {
-
 
2
 
-
 
3
    jQuery('.tooltips').tooltip();
-
 
4
 
-
 
5
    jQuery('#sidebar .sub-menu > a').click(function () {
-
 
6
        var last = jQuery('.sub-menu.open', jQuery('#sidebar'));
-
 
7
        jQuery('.menu-arrow').removeClass('arrow_carrot-right');
-
 
8
        jQuery('.sub', last).slideUp(200);
-
 
9
        var sub = jQuery(this).next();
-
 
10
        if (sub.is(":visible")) {
-
 
11
            jQuery('.menu-arrow').addClass('arrow_carrot-right');
-
 
12
            sub.slideUp(200);
-
 
13
        } else {
-
 
14
            jQuery('.menu-arrow').addClass('arrow_carrot-down');
-
 
15
            sub.slideDown(200);
-
 
16
        }
-
 
17
    });
-
 
18
 
-
 
19
    jQuery('.toggle-nav').click(function () {
-
 
20
        jQuery('#container').toggleClass('sidebar-closed');
-
 
21
    });
-
 
22
 
-
 
23
    var resizeTimer;
-
 
24
    function responsiveView() {
-
 
25
        var wSize = jQuery(window).width();
-
 
26
        if (wSize <= 768) {
-
 
27
            jQuery('#container').addClass('sidebar-closed');
-
 
28
        } else {
-
 
29
            jQuery('#container').removeClass('sidebar-closed');
-
 
30
        }
-
 
31
    }
-
 
32
    jQuery(window).on('load', responsiveView);
-
 
33
    jQuery(window).on('resize', function () {
-
 
34
        clearTimeout(resizeTimer);
-
 
35
        resizeTimer = setTimeout(responsiveView, 150);
-
 
36
    });
-
 
37
}
-
 
38
 
-
 
39
jQuery(document).ready(function () {
-
 
40
    initializeJS();
-
 
41
});
-
 
42