-
Notifications
You must be signed in to change notification settings - Fork 0
/
cv.js
92 lines (83 loc) · 2.68 KB
/
cv.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/**
* Major Péter
* (c) MP 2014
*/
$(document).ready(function(){
var hash = window.location.hash;
if (hash)
navigateToSection(hash);
$('div.popuptitle').click(function(e){
var id = $(this).parent().data('id');
if (!id) return;
if (!$('div#pd'+id).is(':visible'))
openSection(id);
else
closeSection(id);
}).mouseenter(function(e){
$(this).children('span.toggle.hide').fadeIn(150);
}).mouseleave(function(e){
$(this).children('span.toggle.hide').stop().fadeOut(150);
});
$('div.popupcontainer').mouseenter(function(e){
$(this).find('a.anchor').fadeIn(150);
}).mouseleave(function(e){
$(this).find('a.anchor').stop().fadeOut(150);
});
$('div.popuptitle > a.anchor').click(function(e){
var selector = $(this).attr('href');
navigateToSection(selector);
e.stopPropagation();
return false;
});
});
function navigateToSection(selector) {
$('html, body').stop().animate({
scrollTop: $(selector).offset().top - 100
}, 500, function(){
if (!$('div#pd'+selector.substr(1)).is(':visible'))
openSection(selector.substr(1), true);
window.location.hash = selector;
});
}
function openSection(id, scroll) {
$('div#pd'+id).slideDown(300);
$('div#'+id+' > span.toggle').animate({ borderSpacing: 90 }, {
step: function(now,fx) {
$(this).css('-webkit-transform','rotate('+now+'deg)');
$(this).css('-moz-transform','rotate('+now+'deg)');
$(this).css('transform','rotate('+now+'deg)');
},
duration: 300,
complete: function() {
$(this).css('-webkit-transform','rotate(0deg)');
$(this).css('-moz-transform','rotate(0deg)');
$(this).css('transform','rotate(0deg)');
$(this).css('background', 'url(tree_open.png)');
if (scroll)
$('html, body').stop().animate({
scrollTop: $(this).offset().top - 100
}, 500);
}
},'linear');
}
function closeSection(id) {
$('div#pd'+id).slideUp(300);
var toggle = $('div#'+id+' span.toggle');
toggle.css('-webkit-transform','rotate(90deg)');
toggle.css('-moz-transform','rotate(90deg)');
toggle.css('transform','rotate(90deg)');
toggle.css('background', 'url(tree_closed.png)');
toggle.animate({ borderSpacing: 0 }, {
step: function(now,fx) {
$(this).css('-webkit-transform','rotate('+now+'deg)');
$(this).css('-moz-transform','rotate('+now+'deg)');
$(this).css('transform','rotate('+now+'deg)');
},
duration: 300,
complete: function() {
$(this).css('-webkit-transform','rotate(0deg)');
$(this).css('-moz-transform','rotate(0deg)');
$(this).css('transform','rotate(0deg)');
},
},'linear');
}