Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (3 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
        var fixTopMessageHeight = function() {
40
                var topMargin = parseInt($('.mainlogo img').height())+parseInt($('.top-msg').css('marginBottom'));
41
                $('.mainlogo').css('marginTop','-'+topMargin+'px');
42
        }
43
        
44
        if ($('.mainlogo img').length > 0) {
45
                $('.mainlogo img').bind('load', fixTopMessageHeight)
46
        } else {
47
                fixTopMessageHeight();
48
        }
49
        
50
        $('.top-msg a.close').click(function(e) {
51
                e.preventDefault();
52
        $('.top-msg').animate({
53
            paddingTop:'0',
54
            paddingBottom:'0',
55
            height:'0'
56
        }, 1000, function (){
57
             $('.top-msg').removeClass('active')
58
        });
59
        $('.mainlogo').animate({
60
            marginTop:'0'
61
        }, 1000, function (){
62
             //todo
63
        });
64
    });        
65
    //$('select').dropkick();
66
    
67
 
68
    
69
    $('.top-msg .success').parents('.top-msg').css(
70
            {
71
                    backgroundColor: '#00A2B1',
72
                    color: '#fff'
73
            }
74
    )
75
    
76
    $('.top-msg .error').parents('.top-msg').css(
77
            {
78
                    backgroundColor: '#C43F73',
79
                    color: '#fff'
80
            }
81
    )
82
    
83
    
84
    $('.top-msg .warning').parents('.top-msg').css(
85
            {
86
                    backgroundColor: '#F0A216',
87
                    color: '#fff'
88
            }
89
    )
90
    
91
    $('.top-msg .info').parents('.top-msg').css(
92
            {
93
                    backgroundColor: '#75A23A',
94
                    color: '#fff'
95
            }
96
    )
97
    
98
    $('#animation a').hover(
99
      function () {
100
        $(this).animate({
101
         top: '+=-10'   
102
        });
103
        $(this).siblings('p').find('img').animate({
104
          width: '60%'       
105
        });
106
      }, 
107
      function () {
108
        $(this).animate({
109
         top: '0'   
110
            
111
        });
112
        $(this).siblings('p').find('img').animate({
113
          width: '65%'       
114
        });
115
      }
116
    );
117
    
118
    
119
});
120

    
121
$(window).resize(function() {
122
    
123
   setContainerMinHeight('.container .wrapper');
124

    
125
});