-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
67 lines (51 loc) · 1.38 KB
/
index.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
$(function(){
var $document = $(document);
var sections = {
introduction: $('#introduction'),
customize: $('#customize'),
documentation: $('#documentation')
};
var activeSection = sections.introduction;
$('.change-section').click(function(e){
var $target = $(e.currentTarget);
var clickedSection = $target.data().section;
if (!clickedSection || sections[clickedSection] === activeSection){
return;
}
$('.change-section.active').removeClass('active');
$target.addClass('active');
activeSection.fadeOut(function(){
$document.scrollTop(0);
activeSection = sections[clickedSection];
activeSection.fadeIn();
});
e.preventDefault();
});
// var $header = $('.main-header-container');
// var $nav = $('.nav-container');
// var start = $header.scrollTop();
// var end = 70;
// var scrolled;
// var before = true;
// var after = false;
// $(document).scroll(function(e){
// scrolled = $(document).scrollTop();
// // change to header
// if (after && scrolled < end) {
// $nav.fadeOut();
// $header.fadeIn();
// // $header.toggleClass('hide');
// // $nav.toggleClass('hide');
// before = true;
// after = false;
// }
// if (before && scrolled > end) {
// $header.fadeOut();
// $nav.fadeIn();
// // $header.toggleClass('hide');
// // $nav.toggleClass('hide');
// before = false;
// after = true;
// }
// });
});