-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
77 lines (66 loc) · 1.98 KB
/
main.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
70
71
72
73
74
75
76
77
var smallMe = document.getElementById('smallMe')
var hiddenContainer = document.getElementById('hiddenContainer')
smallMe.onclick = function () {
hiddenContainer.style.display = 'block'
}
var spanClose = document.getElementById('close')
spanClose.onclick = function () {
hiddenContainer.style.display = 'none'
}
var footerText = document.getElementById('footerText')
var footerButton = document.querySelector('#footerButton')
footerButton.onmouseover = function () {
footerText.style.fontSize = '1.1rem'
}
footerButton.onmouseout = function () {
footerText.style.fontSize = '1rem'
}
window.onload = function () {
document.onclick = function (e) {
if (e.target.id !== 'smallMe') {
hiddenContainer.style.display = 'none'
}
}
}
function toggleLinks() {
let navlinks = document.querySelector('.navlinks')
navlinks.classList.toggle('navlinksToggleShow')
}
document.querySelector('#burgerMenu').addEventListener('click', toggleLinks)
document.querySelectorAll('a[href^="#"]').forEach((anchor) => {
anchor.addEventListener('click', function (e) {
e.preventDefault()
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth',
})
setTimeout(() => {
toggleLinks()
}, 100)
})
})
const footer = document.querySelector('.footer')
function checkPos() {
let windowY = window.scrollY
if (windowY < 50) {
footer.classList.add('is-visible')
footer.classList.remove('is-hidden')
} else {
footer.classList.add('is-hidden')
footer.classList.remove('is-visible')
}
}
window.addEventListener('scroll', checkPos)
var vsThemeImage = document.getElementById('vsThemeImg')
vsThemeImage.addEventListener('click', function () {
var win = window.open(
'https://marketplace.visualstudio.com/items?itemName=geisslerh.ayu-mirage-bold-italic',
'_blank'
)
if (win) {
//Browser has allowed it to be opened
win.focus()
} else {
//Browser has blocked it
alert('Please allow popups for this website')
}
})