Skip to content

Commit 64600a4

Browse files
committed
Dynamic routing for the latest events and research section
1 parent 672c7c2 commit 64600a4

File tree

6 files changed

+2122
-1499
lines changed

6 files changed

+2122
-1499
lines changed

common template/getNav.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const bodyEl = document.body
2+
3+
fetch('/common template/navbar.html')
4+
.then((res) => res.text())
5+
.then((html) => {
6+
const navEl = document.createElement('header')
7+
navEl.innerHTML = html
8+
bodyEl.prepend(navEl)
9+
carousel()
10+
})
11+
12+
let slideIndex = 0
13+
function carousel() {
14+
const x = document.getElementsByClassName('mySlides')
15+
16+
for (let slide of x) {
17+
slide.style.display = 'none'
18+
}
19+
slideIndex += 1
20+
if (slideIndex > x.length) {
21+
slideIndex = 1
22+
}
23+
x[slideIndex - 1].style.display = 'block'
24+
setTimeout(carousel, 2500)
25+
}

0 commit comments

Comments
 (0)