-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.php
145 lines (114 loc) · 4.74 KB
/
start.php
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
/**
* Created by PhpStorm.
* User: amina
* Date: 29.04.2018
* Time: 09:56
*/
require ("site-info.php");
require ("site-menu.php");
require ("site-content.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="resume_style.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> -->
<!-- jQuery library -->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> -->
<!-- Latest compiled JavaScript -->
<!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> -->
<script>
function scrollspy () {
let i = 0;
let doc = document.getElementById("demo");
let mynav = document.getElementById("mynav");
let linklist = mynav.getElementsByTagName("A");
let link = "";
let hashpositions = [];
let position = [];
for (i = 0; i < linklist.length; i++) {
link = linklist[i].href;
if (link.indexOf("#") > -1) {
position[position.length] = document.getElementById(link.split("#")[1]);
hashpositions[hashpositions.length] = position[i].offsetTop;
// linklist[i].innerHTML = linklist[i].innerHTML + " " + position[i].offsetTop
// + " " + (hashpositions[i] + position[i].clientHeight);
}
}
hashpositions.sort(function(a, b){return a-b});
return function () {
let currentposition = window.pageYOffset;
// doc.innerHTML = currentposition;
for (i = 0; i < hashpositions.length; i++) {
if (currentposition + 10 >= hashpositions[i]) {
linklist[i].parentNode.classList.add("active");
}
else {
linklist[i].parentNode.classList.remove("active");
}
if (currentposition > (hashpositions[i] + position[i].clientHeight)) {
linklist[i].parentNode.classList.remove("active");
}
}
}
}
function scrollsmooth_run (event) {
event.preventDefault();
let myHash = this.hash;
let mysection = document.getElementById(this.hash.substring(1));
let pageYOffset_start = window.pageYOffset;
let pos_diff = mysection.offsetTop - pageYOffset_start;
let pos_diff_delta = pos_diff / 100;
let varCounter = 0;
let id = setInterval(frame, 5);
function frame() {
console.log((mysection.offsetTop - 10) + " < " + window.pageYOffset + " < " + (mysection.offsetTop + 10));
let test = (mysection.offsetTop - 10) < window.pageYOffset && window.pageYOffset < (mysection.offsetTop + 10);
console.log("7: " + test);
if(varCounter <= 110) {
varCounter++;
} else {
clearInterval(id);
}
if ((mysection.offsetTop - 5) < window.pageYOffset && window.pageYOffset < (mysection.offsetTop + 5)) {
clearInterval(id);
} else {
window.scrollTo(window.pageXOffset, window.pageYOffset + pos_diff_delta);
}
}
}
function scrollsmooth () {
let linklist = mynav.getElementsByTagName("A");
for (i = 0; i < linklist.length; i++) {
linklist[i].onclick = scrollsmooth_run;
}
}
document.addEventListener('DOMContentLoaded', function() {
let mybody = document.getElementById("my-body");
mybody.onscroll = scrollspy();
scrollsmooth();
}, false);
</script>
<title>Amin's resume</title>
</head>
<body id="my-body" data-spy="scroll" data-target="#side-menu" data-offset="75">
<div id="container">
<div id="myrow">
<div id="side-info" class="my-column">
<?php echo $siteinfo; ?>
</div>
<div id="side-menu" class="my-column">
<?php echo $sitemenu; ?>
</div>
<div id="content" class="my-column">
<?php echo $sitecontent; ?>
</div>
</div>
</div>
</body>
</html>