-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathcontent.js
75 lines (63 loc) · 1.93 KB
/
content.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
;(function () {
'use strict';
// iPad and iPod detection
var isiPad = function(){
return (navigator.platform.indexOf("iPad") != -1);
};
var isiPhone = function(){
return (
(navigator.platform.indexOf("iPhone") != -1) ||
(navigator.platform.indexOf("iPod") != -1)
);
};
// Parallax
var parallax = function() {
$(window).stellar();
};
// Burger Menu
var burgerMenu = function() {
$('body').on('click', '.js-fh5co-nav-toggle', function(event){
event.preventDefault();
if ( $('#navbar').is(':visible') ) {
$(this).removeClass('active');
} else {
$(this).addClass('active');
}
});
};
var goToTop = function() {
$('.js-gotop').on('click', function(event){
event.preventDefault();
$('html, body').animate({
scrollTop: $('html').offset().top
}, 500);
return false;
});
};
// todo: why is this duplicate with main.js ???
// Page Nav
var clickMenu = function() {
$('#navbar a:not([class="external"])').click(function(event){
var section = $(this).data('nav-section'),
navbar = $('#navbar');
if ( $('[data-section="' + section + '"]').length ) {
$('html, body').animate({
scrollTop: $('[data-section="' + section + '"]').offset().top
}, 500);
}
if ( navbar.is(':visible')) {
navbar.removeClass('in');
navbar.attr('aria-expanded', 'false');
$('.js-fh5co-nav-toggle').removeClass('active');
}
event.preventDefault();
return false;
});
};
// Document on load.
$(function(){
parallax();
burgerMenu();
clickMenu();
});
}());