-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslides.js
78 lines (66 loc) · 2 KB
/
slides.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
setTitle = function(obj, nr) {
nr = nr - 1;
document.getElementById("eo-title").innerHTML = (obj.desc[nr].title);
document.getElementById("eo-description").innerHTML = (obj.desc[nr].text);
}
var img = document.getElementById("eo");
var nr = 1;
var subdir = "Iceland";
var desc = iceland_desc;
var maxpic = iceland_desc.nr;
manageColDesc = function(desc_name) {
// if first image, display collection description
if(nr == 1) {
document.getElementById("col_desc_title").innerHTML = subdir;
document.getElementById("col_desc_desc").innerHTML = desc_name.col_desc;
}
else {
document.getElementById("col_desc_title").innerHTML = "";
document.getElementById("col_desc_desc").innerHTML = "";
}
}
next = function(){
nr = nr + 1;
if (nr > maxpic) {
nr = 1;
}
let link = "pictures/" + subdir + "/" + nr + ".jpg";
img.src = link;
setTitle(desc, nr);
manageColDesc(desc);
}
prev = function() {
nr = nr - 1;
if (nr <= 0) {
nr = maxpic;
}
let link = "pictures/" + subdir + "/" + nr + ".jpg";
img.src = link;
setTitle(desc, nr);
manageColDesc(desc);
}
setCollection = function(folder, new_desc, mp) {
console.log("setCollection called")
desc = new_desc;
maxpic = mp;
subdir = folder;
let link = "pictures/" + subdir + "/1.jpg";
img.src = link;
nr = 1;
setTitle(desc, nr);
manageColDesc(new_desc);
/*document.addEventListener('readystatechange', event => {
// When HTML/DOM elements are ready:
if (event.target.readyState === "interactive") { //does same as: ..addEventListener("DOMContentLoaded"..
alert("hi 1");
}
// When window loaded ( external resources are loaded too- `css`,`src`, etc...)
if (event.target.readyState === "complete") {
alert("hi 2");
}
}); */
}
onloadDo = function() {
setCollection("Iceland", iceland_desc, iceland_desc.nr)
setTitle(iceland_desc, 1)
}