-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
41 lines (37 loc) · 1.1 KB
/
script.js
File metadata and controls
41 lines (37 loc) · 1.1 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
// Smooth scrolling
$(document).ready(function() {
$('a[href^="#"]').on('click', function(event) {
var target = $(this.getAttribute('href'));
if( target.length ) {
event.preventDefault();
$('html, body').stop().animate({
scrollTop: target.offset().top
}, 1000);
}
});
});
// Animate header
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {
$('.navbar').addClass('animated');
} else {
$('.navbar').removeClass('animated');
}
});
// Animate project descriptions and profile picture
$(window).scroll(function() {
$('.project').each(function() {
if ($(window).scrollTop() > $(this).offset().top - 400) {
$(this).addClass('animated');
}
});
if ($(window).scrollTop() > $('#profile').offset().top - 400) {
$('#profile').addClass('animated');
}
});
// Change color of navigation links on hover
$('.navbar-nav>li>a').hover(function(){
$(this).css("color", "#fff");
}, function(){
$(this).css("color", "#000");
});