-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
76 lines (66 loc) · 1.99 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
68
69
70
71
72
73
74
75
76
var heroShinker = function () {
var hero = $('.hero-nav'),
heroHeight = $('.hero-nav').outerHeight(true);
var navBar = $('#NavBar');
var carousel = $('#heroCarousel');
$(hero).parent().css('padding-top', heroHeight);
$(window).scroll(function () {
var scrollOffset = $(window).scrollTop();
if (scrollOffset < heroHeight) {
$(hero).css('height', (heroHeight - scrollOffset));
}
if (scrollOffset > (heroHeight - 220)) {
hero.addClass('fixme');
navBar.addClass('navBgColor');
carousel.fadeOut("fast");
} else {
hero.removeClass('fixme');
carousel.fadeIn("fast");
navBar.removeClass('navBgColor');
};
});
}
heroShinker();
// about us
$(document).ready(function () {
var curPage = 1;
var numOfPages = $(".skw-page").length;
var animTime = 1000;
var scrolling = false;
var pgPrefix = ".skw-page-";
function pagination() {
scrolling = true;
$(pgPrefix + curPage).removeClass("inactive").addClass("active");
$(pgPrefix + (curPage - 1)).addClass("inactive");
$(pgPrefix + (curPage + 1)).removeClass("active");
setTimeout(function () {
scrolling = false;
}, animTime);
};
function navigateUp() {
if (curPage === 1) return;
curPage--;
pagination();
};
function navigateDown() {
if (curPage === numOfPages) return;
curPage++;
pagination();
};
$(document).on("mousewheel DOMMouseScroll", function (e) {
if (scrolling) return;
if (e.originalEvent.wheelDelta > 0 || e.originalEvent.detail < 0) {
navigateUp();
} else {
navigateDown();
}
});
$(document).on("keydown", function (e) {
if (scrolling) return;
if (e.which === 38) {
navigateUp();
} else if (e.which === 40) {
navigateDown();
}
});
});