-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
51 lines (43 loc) · 1.21 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
// scroll top & smooth scrolling
$(document).ready(function() {
var scrollLink = $('.scroll');
// Smooth scrolling
scrollLink.click(function(e) {
e.preventDefault();
$('body,html').animate({
scrollTop: $(this.hash).offset().top
}, 1000 );
});
// Active link switching
$(window).scroll(function() {
var scrollbarLocation = $(this).scrollTop();
scrollLink.each(function() {
var sectionOffset = $(this.hash).offset().top - 20;
if ( sectionOffset <= scrollbarLocation ) {
$(this).parent().addClass('active');
$(this).parent().siblings().removeClass('active');
}
})
})
})
$(document).ready(function(){
$(window).scroll(function(){
if($(this).scrollTop() > 700){
$('#topBtn').fadeIn();
} else{
$('#topBtn').fadeOut();
}
});
$("#topBtn").click(function(){
$('html ,body').animate({scrollTop : 0},800);
});
});
// scroll top & smooth scrolling
// scroll down
$(function() {
$('.scroll-down').click (function() {
$('html, body').animate({scrollTop: $('section.about').offset().top }, 'slow');
return false;
});
});
// scroll down