This repository has been archived by the owner on Mar 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
69 lines (65 loc) · 2.28 KB
/
index.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
65
66
67
68
69
var width = $(window).width();
window.onscroll = function(){
if ((width >= 1000)){
if(document.body.scrollTop > 80 || document.documentElement.scrollTop > 80) {
$("#header").css("background","#fff");
$("#header").css("color","#000");
$("#header").css("box-shadow","0px 0px 20px rgba(0,0,0,0.09)");
$("#header").css("padding","4vh 4vw");
$("#navigation a").hover(function(){
$(this).css("border-bottom","2px solid rgb(255, 44, 90)");
},function(){
$(this).css("border-bottom","2px solid transparent");
});
}else{
$("#header").css("background","transparent");
$("#header").css("color","#fff");
$("#header").css("box-shadow","0px 0px 0px rgba(0,0,0,0)");
$("#header").css("padding","6vh 4vw");
$("#navigation a").hover(function(){
$(this).css("border-bottom","2px solid #fff");
},function(){
$(this).css("border-bottom","2px solid transparent");
});
}
}
}
//magnify the image when clicked/focus on the image
function magnify(imglink){
$("#img_here").css("background",`url('${imglink}') center center`);
$("#magnify").css("display","flex");
$("#magnify").addClass("animated fadeIn");
setTimeout(function(){
$("#magnify").removeClass("animated fadeIn");
},800);
}
//function to close the magnified image/the X button's code
function closemagnify(){
$("#magnify").addClass("animated fadeOut");
setTimeout(function(){
$("#magnify").css("display","none");
$("#magnify").removeClass("animated fadeOut");
$("#img_here").css("background",`url('') center center`);
},800);
}
//animation
setTimeout(function(){
$("#loading").addClass("animated fadeOut");
setTimeout(function(){
$("#loading").removeClass("animated fadeOut");
$("#loading").css("display","none");
},800);
},1650);
$(document).ready(function(){
$("a").on('click', function(event) {
if (this.hash !== "") {
event.preventDefault();
var hash = this.hash;
$('body,html').animate({
scrollTop: $(hash).offset().top
}, 1800, function(){
window.location.hash = hash;
});
}
});
});