blob: 5743b5e3ca81eb6411d814bf7b9d02aab4cfaa0c (
plain)
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
|
import { ParkArticle } from "./templateImplementations.js";
import {
fetchAttractions,
displayNumberOfItemsInShoppingBasketWithBadge,
dutchCurrencyFormat,
dutchCurrencyFormatWithSign,
findParent,
killChildren,
} from "./utils.js";
// ik struggle een beetje met de database connecten met de api...
//
// loop ineens tegen de volgende error aan:
function displayArticles(articles) {
console.log("displaying attraction articles");
for (var i = 0; i < articles.length; i++) {
var parkArticle = new ParkArticle(articles[i], document.querySelector("#parkarticle"));
parkArticle.addToNode(document.querySelector("#center-articles"));
}
}
function setStickyNavBar() {
console.log("making the navbar sticky");
// Get the header
var header = document.getElementById("sticky-header");
// Get the offset position of the navbar
var sticky = header.offsetTop;
// Add the sticky class to the header when you reach its scroll position. Remove "sticky" when you leave the scroll position
function makeHeaderStickyWhenScrolling() {
if (window.pageYOffset > sticky) {
header.classList.add("sticky");
} else {
header.classList.remove("sticky");
}
}
// Sticky navigation bar stuff
//
// When the user scrolls the page, execute myFunction
window.onscroll = function() {makeHeaderStickyWhenScrolling()};
}
displayNumberOfItemsInShoppingBasketWithBadge();
setStickyNavBar();
const sortmenu = document.querySelector("#sortmenu");
console.log(sortmenu)
fetchAttractions()
.then(displayArticles);
|