Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
93 lines (73 loc) · 2.54 KB
/
Copy pathscript.js
File metadata and controls
93 lines (73 loc) · 2.54 KB
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
93
$(document).ready(function () {
/* for sticky navagation */
$('.js--section-testimonials').waypoint(function (direction) {
if (direction == "down") {
$('nav').addClass('sticky');
} else {
$('nav').removeClass('sticky');
}
}, {
offset: '60px'
});
/* scroll on button click */
$('.js--scroll-to-contact').click(function () {
$('html, body').animate({ scrollTop: $('.js--section-form').offset().top }, 1000);
});
$('.js--scroll-to-services').click(function () {
$('html, body').animate({ scrollTop: $('.js--section-services').offset().top }, 1000);
});
/* Navigation scroll */
$(function () {
$('a[href*=\\#]:not([href=\\#])').click(function () {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
/* ANIMATION ON SCROLL */
$('.js--wp0').waypoint(function (direction) {
$('.js--wp0').addClass('animated pulse');
}, {
offset: '0%'
});
$('.js--wp1').waypoint(function (direction) {
$('.js--wp1').addClass('animated fadeInRight');
}, {
offset: '55%'
});
$('.js--wp2').waypoint(function (direction) {
$('.js--wp2').addClass('animated pulse');
}, {
offset: '55%'
});
$('.js--wp4').waypoint(function (direction) {
$('.js--wp4').addClass('animated rubberBand');
}, {
offset: '85%'
});
$('.js--wp5').waypoint(function (direction) {
$('.js--wp5').addClass('animated wobble');
}, {
offset: '85%'
});
/* NAV ANIMATION */
$('.js--nav-icon').click(function () {
var nav = $('.js--main-nav');
var icon = $('.js--nav-icon svg');
nav.slideToggle(200);
if (icon.hasClass('fa-bars')) {
icon.addClass('fa-times');
icon.removeClass('fa-bars');
} else {
icon.addClass('fa-bars');
icon.removeClass('fa-times');
}
});
});