-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
31 lines (28 loc) · 894 Bytes
/
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
window.onscroll = () => {
const nav = document.querySelector('#navbar');
const name = document.querySelector('#myname');
if(this.scrollY <= window.innerHeight - 35) {
nav.className = '';
name.className = '';
} else {
nav.className = 'scroll';
name.className='scroll';
}
};
function goToSection(str) {
document.getElementById(str).scrollIntoView(true);
}
(function($) {
$('a.js-scroll-trigger[href*="#"]:not([href="#"])').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)
}, 1000, "easeInOutExpo");
return false;
}
}
});
})(jQuery);