root / snf-astakos-app / astakos / im / static / im / js / common.js @ d9484003
History | View | Annotate | Download (4.9 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 |
// fix for iPhone - iPad orientation bug
|
17 |
var metas = document.getElementsByTagName('meta'); |
18 |
function resetViewport() { |
19 |
var i;
|
20 |
if (navigator.userAgent.match(/iPhone/i)) { |
21 |
for (i=0; i<metas.length; i++) { |
22 |
if (metas[i].name == "viewport") { |
23 |
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
|
24 |
} |
25 |
} |
26 |
} |
27 |
} |
28 |
resetViewport(); |
29 |
|
30 |
window.onorientationchange = function() { |
31 |
resetViewport(); |
32 |
}; |
33 |
|
34 |
function gestureStart() { |
35 |
for (i=0; i<metas.length; i++) { |
36 |
if (metas[i].name == "viewport") { |
37 |
metas[i].content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6";
|
38 |
} |
39 |
} |
40 |
} |
41 |
document.addEventListener("gesturestart", gestureStart, false); |
42 |
|
43 |
//end of fix
|
44 |
|
45 |
$(document).ready(function() { |
46 |
|
47 |
|
48 |
setContainerMinHeight('.container .wrapper');
|
49 |
|
50 |
|
51 |
$('.show-extra').click(function(e) { |
52 |
e.preventDefault(); |
53 |
$(this).parents('.bg-wrap').find('.extra').slideToggle(600); |
54 |
}); |
55 |
$('.hide-extra').click(function(e) { |
56 |
e.preventDefault(); |
57 |
$(this).parents('.bg-wrap').find('.extra').slideUp(600); |
58 |
}); |
59 |
|
60 |
$('.box-more p').click(function(e) { |
61 |
$(this).siblings('.clearfix').toggle('slow'); |
62 |
$(this).parents('.box-more').toggleClass('border'); |
63 |
}); |
64 |
|
65 |
var fixTopMessageHeight = function() { |
66 |
var topMargin = parseInt($('.mainlogo img').height())+parseInt($('.top-msg').css('marginBottom')); |
67 |
$('.mainlogo').css('marginTop','-'+topMargin+'px'); |
68 |
} |
69 |
|
70 |
if ($('.mainlogo img').length > 0) { |
71 |
$('.mainlogo img').bind('load', fixTopMessageHeight) |
72 |
} else {
|
73 |
fixTopMessageHeight(); |
74 |
} |
75 |
|
76 |
$('.top-msg a.close').click(function(e) { |
77 |
e.preventDefault(); |
78 |
$('.top-msg').animate({ |
79 |
paddingTop:'0', |
80 |
paddingBottom:'0', |
81 |
height:'0' |
82 |
}, 1000, function (){ |
83 |
$('.top-msg').removeClass('active') |
84 |
}); |
85 |
$('.mainlogo').animate({ |
86 |
marginTop:'0' |
87 |
}, 1000, function (){ |
88 |
//todo
|
89 |
}); |
90 |
}); |
91 |
//$('select').dropkick();
|
92 |
|
93 |
|
94 |
|
95 |
$('.top-msg .success').parents('.top-msg').css( |
96 |
{ |
97 |
backgroundColor: '#77C596', |
98 |
color: '#fff' |
99 |
} |
100 |
); |
101 |
|
102 |
$('.top-msg .error').parents('.top-msg').css( |
103 |
{ |
104 |
backgroundColor: '#EF4F54', |
105 |
color: '#fff' |
106 |
} |
107 |
); |
108 |
|
109 |
|
110 |
$('.top-msg .warning').parents('.top-msg').css( |
111 |
{ |
112 |
backgroundColor: '#F6921E', |
113 |
color: '#fff' |
114 |
} |
115 |
); |
116 |
|
117 |
$('.top-msg .info').parents('.top-msg').css( |
118 |
{ |
119 |
backgroundColor: '#C3C3B9', |
120 |
color: '#fff' |
121 |
} |
122 |
); |
123 |
|
124 |
// clouds homepage animation
|
125 |
$('#animation a').hover( |
126 |
function () {
|
127 |
|
128 |
$(this).animate({ |
129 |
top: '+=-10' |
130 |
}, 600, function() { |
131 |
if ($(this).find('img').attr('src').indexOf("_top") == -1) { |
132 |
var src = $(this).find('img').attr('src').replace('.png', '_top.png') |
133 |
$(this).find('img').attr("src", src); |
134 |
} |
135 |
|
136 |
}); |
137 |
$(this).siblings('p').find('img').animate({ |
138 |
width: '60%' |
139 |
}); |
140 |
}, |
141 |
function () {
|
142 |
|
143 |
$(this).animate({top: '0'}, 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 |
/*$('#animation a').hover(
|
155 |
function () {
|
156 |
var src = $(this).find('img').attr('src').replace('.png', '_top.png')
|
157 |
$(this).find('img').attr("src", src);
|
158 |
$(this).animate({
|
159 |
top: '+=-10'
|
160 |
}, 600, function() {
|
161 |
// action to do when animation is finished
|
162 |
});
|
163 |
$(this).siblings('p').find('img').animate({
|
164 |
width: '60%'
|
165 |
});
|
166 |
},
|
167 |
function () {
|
168 |
|
169 |
$(this).animate({
|
170 |
top: '0'
|
171 |
|
172 |
}, 600, function() {
|
173 |
var src = $(this).find('img').attr('src').replace('_top.png', '.png')
|
174 |
$(this).find('img').attr("src", src);
|
175 |
});
|
176 |
$(this).siblings('p').find('img').animate({
|
177 |
width: '65%'
|
178 |
});
|
179 |
}
|
180 |
);*/
|
181 |
|
182 |
|
183 |
}); |
184 |
|
185 |
$(window).resize(function() { |
186 |
|
187 |
setContainerMinHeight('.container .wrapper');
|
188 |
|
189 |
}); |