Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / static / im / js / common.js @ 05294828

History | View | Annotate | Download (2.6 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
        $('.top-msg').animate({
52
            paddingTop:'0',
53
            paddingBottom:'0',
54
            height:'0'
55
        }, 1000, function (){
56
             $('.top-msg').removeClass('active')
57
        });
58
        $('.mainlogo').animate({
59
            marginTop:'0'
60
        }, 1000, function (){
61
             //todo
62
        });
63
    });        
64
    //$('select').dropkick();
65
    
66
 
67
    
68
    $('.top-msg .success').parents('.top-msg').css(
69
            {
70
                    backgroundColor: '#00A2B1',
71
                    color: '#fff'
72
            }
73
    )
74
    
75
    $('.top-msg .error').parents('.top-msg').css(
76
            {
77
                    backgroundColor: '#C43F73',
78
                    color: '#fff'
79
            }
80
    )
81
    
82
    
83
    $('.top-msg .warning').parents('.top-msg').css(
84
            {
85
                    backgroundColor: '#F0A216',
86
                    color: '#fff'
87
            }
88
    )
89
    
90
    $('.top-msg .info').parents('.top-msg').css(
91
            {
92
                    backgroundColor: '#75A23A',
93
                    color: '#fff'
94
            }
95
    )
96
    
97
});
98

    
99
$(window).resize(function() {
100
    
101
   setContainerMinHeight('.container .wrapper');
102

    
103
});