-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
66 lines (50 loc) · 1.59 KB
/
script.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
/*----------------------------------------------------*/
/* Quote Loop
------------------------------------------------------ */
function fade($ele) {
$ele.fadeIn(1000).delay(3000).fadeOut(1000, function() {
var $next = $(this).next('.quote');
fade($next.length > 0 ? $next : $(this).parent().children().first());
});
}
fade($('.quoteLoop > .quote').first());
/*----------------------------------------------------*/
/* Navigation
------------------------------------------------------ */
$(window).scroll(function() {
if ($(window).scrollTop() > 300) {
$('.main_nav').addClass('sticky');
} else {
$('.main_nav').removeClass('sticky');
}
});
// Mobile Navigation
$('.mobile-toggle').click(function() {
if ($('.main_nav').hasClass('open-nav')) {
$('.main_nav').removeClass('open-nav');
} else {
$('.main_nav').addClass('open-nav');
}
});
$('.main_nav li a').click(function() {
if ($('.main_nav').hasClass('open-nav')) {
$('.navigation').removeClass('open-nav');
$('.main_nav').removeClass('open-nav');
}
});
/*----------------------------------------------------*/
/* Smooth Scrolling
------------------------------------------------------ */
jQuery(document).ready(function($) {
$('.smoothscroll').on('click',function (e) {
e.preventDefault();
var target = this.hash,
$target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 800, 'swing', function () {
window.location.hash = target;
});
});
});
TweenMax.staggerFrom(".heading", 0.8, {opacity: 0, y: 20, delay: 0.2}, 0.4);