root / snf-cyclades-app / synnefo / ui / new_ui / ui / javascripts / common.js @ 01fa9e32
History | View | Annotate | Download (1.3 kB)
1 |
ui = {}; |
---|---|
2 |
|
3 |
|
4 |
ui.closeDiv = function(closeEl, divToCloseClass) { |
5 |
closeEl.click(function(e){
|
6 |
e.preventDefault(); |
7 |
$(this).parents(divToCloseClass).slideUp('slow'); |
8 |
}); |
9 |
} |
10 |
|
11 |
|
12 |
// set lt-sidebar height
|
13 |
ui.setSidebarHeight = function(){ |
14 |
var WindowHeight = $(window).height(); |
15 |
var h1= WindowHeight - $('.header').outerHeight(); |
16 |
var h2= $('.main.details').outerHeight(); |
17 |
if (h2>h1) {
|
18 |
var ltSidebarHeight = h2;
|
19 |
} else {
|
20 |
var ltSidebarHeight = h1;
|
21 |
} |
22 |
$('.lt-sidebar').height(ltSidebarHeight); |
23 |
} |
24 |
|
25 |
|
26 |
|
27 |
$(document).ready(function(){ |
28 |
|
29 |
ui.closeDiv($('.info .close'), '.info'); |
30 |
ui.closeDiv($('.dummy-navigation .close'), '.dummy-navigation'); |
31 |
|
32 |
$('.dummy-navigation .our').click(function(e){ |
33 |
e.preventDefault(); |
34 |
$('.ours.'+$(this).data('our')).toggle(); |
35 |
$(this).toggleClass('open'); |
36 |
}); |
37 |
|
38 |
ui.setSidebarHeight(); |
39 |
$('.select-os li').click(function(e){ |
40 |
$('.select-os li').removeClass('selected'); |
41 |
$(this).addClass('selected'); |
42 |
}) |
43 |
|
44 |
$('.select-flavor dl span').click(function(e){ |
45 |
console.log('test');
|
46 |
$(this).parents('dl').find('span').removeClass('current'); |
47 |
$(this).addClass('current'); |
48 |
}) |
49 |
|
50 |
if ($('.overlay').length >0 ){ |
51 |
$('body').addClass('with-overlay'); |
52 |
} |
53 |
|
54 |
$('.new-btn a.current').click(function(e){ |
55 |
e.preventDefault(); |
56 |
}) |
57 |
|
58 |
|
59 |
|
60 |
|
61 |
}) |
62 |
|
63 |
$(window).resize(function(e){ |
64 |
ui.setSidebarHeight(); |
65 |
|
66 |
}) |