-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
72 lines (47 loc) · 1.19 KB
/
app.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
$(function() {
/* Fixed header */
let header = $("#header");
let intro = $("#intro");
let introH = intro.innerHeight();
let scrollPos = $(window).scrollTop();
let nav = $("#nav");
let navToggle = $("#navToggle");
checkScroll(scrollPos, introH);
$(window).on("scroll resize", function(){
let introH = intro.innerHeight();
scrollPos = $(this).scrollTop();
checkScroll(scrollPos, introH);
});
function checkScroll(scrollPos, introH){
if(scrollPos > introH){
header.addClass("fixed");
} else {
header.removeClass("fixed");
}
}
/* Smooth scroll */
$("[data-scroll]").on("click", function(event){
event.preventDefault();
let elementId = $(this).data('scroll');
let elementOffset = $(elementId).offset().top;
nav.removeClass("show");
$("html, body").animate({
scrollTop: elementOffset - 70
}, 700);
});
/* Nav Toggle */
navToggle.on("click", function(event){
event.preventDefault();
nav.toggleClass("show");
});
/* Reviews https://kenwheeler.github.io/slick/ */
let slider = $("#reviewsSlider");
slider.slick({
infinite: true,
slidesToShow: 1,
slidesToScroll: 1,
fade: true,
arrows: false,
dots: true
});
});