root / cloudcms / static / cloudcms / js / common.js @ 0835eb8c
History | View | Annotate | Download (4.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 |
$(this).parents('.bg-wrap').find('.extra').slideToggle(600); |
25 |
}); |
26 |
$('.hide-extra').click(function(e) { |
27 |
e.preventDefault(); |
28 |
$(this).parents('.bg-wrap').find('.extra').slideUp(600); |
29 |
}); |
30 |
|
31 |
$('.box-more p').click(function(e) { |
32 |
$(this).siblings('.clearfix').toggle('slow'); |
33 |
$(this).parents('.box-more').toggleClass('border'); |
34 |
}); |
35 |
|
36 |
var fixTopMessageHeight = function() { |
37 |
var topMargin = parseInt($('.mainlogo img').height())+parseInt($('.top-msg').css('marginBottom')); |
38 |
$('.mainlogo').css('marginTop','-'+topMargin+'px'); |
39 |
} |
40 |
|
41 |
if ($('.mainlogo img').length > 0) { |
42 |
$('.mainlogo img').bind('load', fixTopMessageHeight) |
43 |
} else {
|
44 |
fixTopMessageHeight(); |
45 |
} |
46 |
|
47 |
$('.top-msg a.close').click(function(e) { |
48 |
e.preventDefault(); |
49 |
$('.top-msg').animate({ |
50 |
paddingTop:'0', |
51 |
paddingBottom:'0', |
52 |
height:'0' |
53 |
}, 1000, function (){ |
54 |
$('.top-msg').removeClass('active') |
55 |
}); |
56 |
$('.mainlogo').animate({ |
57 |
marginTop:'0' |
58 |
}, 1000, function (){ |
59 |
//todo
|
60 |
}); |
61 |
}); |
62 |
//$('select').dropkick();
|
63 |
|
64 |
|
65 |
|
66 |
$('.top-msg .success').parents('.top-msg').css( |
67 |
{ |
68 |
backgroundColor: '#77C596', |
69 |
color: '#fff' |
70 |
} |
71 |
); |
72 |
|
73 |
$('.top-msg .error').parents('.top-msg').css( |
74 |
{ |
75 |
backgroundColor: '#EF4F54', |
76 |
color: '#fff' |
77 |
} |
78 |
); |
79 |
|
80 |
|
81 |
$('.top-msg .warning').parents('.top-msg').css( |
82 |
{ |
83 |
backgroundColor: '#F6921E', |
84 |
color: '#fff' |
85 |
} |
86 |
); |
87 |
|
88 |
$('.top-msg .info').parents('.top-msg').css( |
89 |
{ |
90 |
backgroundColor: '#C3C3B9', |
91 |
color: '#fff' |
92 |
} |
93 |
); |
94 |
|
95 |
// clouds homepage animation
|
96 |
$('#animation a').hover( |
97 |
function () {
|
98 |
|
99 |
$(this).animate({ |
100 |
top: '+=-10' |
101 |
}, 600, function() { |
102 |
if ($(this).find('img').attr('src').indexOf("_top") == -1) { |
103 |
var src = $(this).find('img').attr('src').replace('.png', '_top.png') |
104 |
$(this).find('img').attr("src", src); |
105 |
} |
106 |
|
107 |
}); |
108 |
$(this).siblings('p').find('img').animate({ |
109 |
width: '60%' |
110 |
}); |
111 |
}, |
112 |
function () {
|
113 |
|
114 |
$(this).animate({top: '0'}, 600, function() { |
115 |
var src = $(this).find('img').attr('src').replace('_top.png', '.png') |
116 |
$(this).find('img').attr("src", src); |
117 |
}); |
118 |
$(this).siblings('p').find('img').animate({ |
119 |
width: '65%' |
120 |
}); |
121 |
} |
122 |
); |
123 |
|
124 |
|
125 |
/*$('#animation a').hover(
|
126 |
function () {
|
127 |
var src = $(this).find('img').attr('src').replace('.png', '_top.png')
|
128 |
$(this).find('img').attr("src", src);
|
129 |
$(this).animate({
|
130 |
top: '+=-10'
|
131 |
}, 600, function() {
|
132 |
// action to do when animation is finished
|
133 |
});
|
134 |
$(this).siblings('p').find('img').animate({
|
135 |
width: '60%'
|
136 |
});
|
137 |
},
|
138 |
function () {
|
139 |
|
140 |
$(this).animate({
|
141 |
top: '0'
|
142 |
|
143 |
}, 600, function() {
|
144 |
var src = $(this).find('img').attr('src').replace('_top.png', '.png')
|
145 |
$(this).find('img').attr("src", src);
|
146 |
});
|
147 |
$(this).siblings('p').find('img').animate({
|
148 |
width: '65%'
|
149 |
});
|
150 |
}
|
151 |
);*/
|
152 |
|
153 |
|
154 |
}); |
155 |
|
156 |
$(window).resize(function() { |
157 |
|
158 |
setContainerMinHeight('.container .wrapper');
|
159 |
|
160 |
}); |