-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtiming.js
More file actions
72 lines (57 loc) · 2.02 KB
/
timing.js
File metadata and controls
72 lines (57 loc) · 2.02 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
//PARALAX ZOOM OUT
$(window).scroll(function() {
$(".parallax img").css({
width: (250 - $(window).scrollTop() / 1.5) + "%",
top: -($(window).scrollTop() / 10) + "%",
});
});
// jQuery for page scrolling feature - requires jQuery Easing plugin
function collapseNavbar() {
if ($(".navbar").offset().top > 50) {
$(".navbar-fixed-top").addClass("top-nav-collapse");
} else {
$(".navbar-fixed-top").removeClass("top-nav-collapse");
}
}
$(window).scroll(collapseNavbar);
$(document).ready(collapseNavbar);
$(function() {
$('body').on('click', '.page-scroll a', function(event) {
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1500, 'easeInOutExpo');
event.preventDefault();
});
});
// Closes the Responsive Menu on Menu Item Click
$('.navbar-collapse ul li a').click(function() {
$('.navbar-toggle:visible').click();
});
// Bouncing arrow bottom of full screen
// Different arrow choices from Font Awesome
// Fades away as you scroll down
$(window).scroll(function() {
$(".arrow").css("opacity", 1 - $(window).scrollTop() / 250);
//250 is fade pixels
});
// Highlight the top nav as scrolling occurs
$('body').scrollspy({
target: '.navbar-fixed-top'
})
$(function() {
// This will select everything with the class smoothScroll
// This should prevent problems with carousel, scrollspy, etc...
$('.smoothScroll').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
}, 1500); // The number here represents the speed of the scroll in milliseconds
return false;
}
}
});
});