forked from SrichandraA/giridhar.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.js
64 lines (52 loc) · 1.68 KB
/
scripts.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
$(document).ready(function(){
if($(window).scrollTop() === 0){
$("nav").css("opacity","0.3");
// $("nav").css("background","linear-gradient(to right, rgba(108, 72, 169, 0.3) 0%,rgba(255, 40, 122, 0.3) 100%)");
}
else{
$("nav").css("opacity","1");
$(".nav-name").css("margin-left","0");
}
$(window).scroll(function(){
var scroll = $(window).scrollTop();
if(scroll<560){
$(".nav-name").css("margin-left",560-scroll);
$("nav").css("opacity",0.3+0.001*scroll);
}
else if (scroll > 560) {
$("nav").css("opacity",1);
}
$('#nav-resume').toggleClass('active-keep',
//add 'ok' class when div position match or exceeds else remove the 'ok' class.
scroll >= $('#resume').offset().top-60,
);
if($(this).scrollTop()>=$('#resume').position().top-60){
$("#nav-work").removeClass("active-keep");
}
if($(this).scrollTop()>=$('#start').position().top-60 && $(this).scrollTop()<=$('#resume').position().top-60){
$("#nav-work").addClass("active-keep");
}
});
$(".navbar a").on('click', function(event) {
if (this.hash !== "") {
event.preventDefault();
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 800, function(){
window.location.hash = hash;
});
}
});
$("#arrowclick").on('click', function(event) {
if (this.hash !== "") {
event.preventDefault();
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 800, function(){
window.location.hash = hash;
});
}
});
})