Statistics
| Branch: | Tag: | Revision:

root / cloudcms / static / cloudcms / js / common.js @ b694b7a8

History | View | Annotate | Download (2.2 kB)

1
function setContainerMinHeight( applicableDiv){
2
        
3
    if ( $(applicableDiv).length > 0 ) {
4
        //var h = $('.header').height(); div.header is not found 
5
        var f = $('.footer').height();
6
        var w = $(window).height();
7
        var pTop = parseInt (($(applicableDiv).css('padding-top').replace("px", "")) );
8
        var pBottom = parseInt (($(applicableDiv).css('padding-bottom').replace("px", "")));
9

    
10
        var c = w - ( f+pTop+pBottom+36);//36 is header's height.
11
        $(applicableDiv).css('min-height', c);
12
    }    
13

    
14
}
15

    
16
$(document).ready(function() {
17
        
18
         
19
    setContainerMinHeight('.container .wrapper');
20
    
21
        
22
    $('.show-extra').click(function(e) {
23
        e.preventDefault();
24
        
25
        $(this).parents('.bg-wrap').find('.extra').toggle('slow');
26
        $('.hide-extra').toggle();    
27
    });
28
    $('.hide-extra').click(function(e) {
29
        e.preventDefault();
30
        $(this).hide();
31
        $(this).parents('.bg-wrap').find('.extra').hide('slow');
32
    });
33
    
34
    $('.box-more p').click(function(e) {
35
        $(this).siblings('.clearfix').toggle('slow');
36
        $(this).parents('.box-more').toggleClass('border');
37
    });
38
        
39
                
40
        var topMargin=parseInt($('.mainlogo').height())+parseInt($('.top-msg').css('marginBottom'));
41
        $('.mainlogo').css('marginTop','-'+topMargin+'px')
42
        
43
        $('.top-msg a.close').click(function(e) {
44
        $('.top-msg').animate({
45
            paddingTop:'0',
46
            paddingBottom:'0',
47
            height:'0'
48
        }, 1000, function (){
49
             $('.top-msg').removeClass('active')
50
        });
51
        $('.mainlogo').animate({
52
            marginTop:'0'
53
        }, 1000, function (){
54
             //todo
55
        });
56
    });        
57
    //$('select').dropkick();
58
    
59
 
60
    
61
    $('.top-msg .success').parents('.top-msg').css(
62
            {
63
                    backgroundColor: '#f3c',
64
                    color: '#fff'
65
            }
66
    )
67
    
68
    $('.top-msg .error').parents('.top-msg').css(
69
            {
70
                    backgroundColor: 'red',
71
                    color: '#fff'
72
            }
73
    )
74
    
75
    
76
    $('.top-msg .warning').parents('.top-msg').css(
77
            {
78
                    backgroundColor: '#90f',
79
                    color: '#fff'
80
            }
81
    )
82
    
83
});
84

    
85
$(window).resize(function() {
86
    
87
   setContainerMinHeight('.container .wrapper');
88

    
89
});