-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
48 lines (42 loc) · 1.51 KB
/
Copy pathapp.js
File metadata and controls
48 lines (42 loc) · 1.51 KB
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
/* Lionelweb.com Javascript
/* 0. Debugging Variable
************************/
var ldg_debug = {
logLevel: 1,
log: function (msg) {
if (ldg_debug.logLevel > 0) {
console.log(msg);
}
}
};
ldg_debug.log("Logging Level " + ldg_debug.logLevel + " Enabled!");
/* 1. Portolio Accordian Functionality
**************************************/
var detailLabels = document.querySelectorAll("label.details");
ldg_debug.log("detailLabels = " + detailLabels);
for (var i = 0; i < detailLabels.length; i++) {
ldg_debug.log("detailLabels[" + i + "] = " + detailLabels[i]);
if(detailLabels[i].hasAttribute("for")) {
detailLabels[i].onclick = function(e) {
e.preventDefault();
parentInput = this.control;
parentInput.checked = !parentInput.checked;
parentInputName = parentInput.getAttribute("name");
if(parentInput.checked) {
ldg_debug.log("Checked a details input for " + parentInputName);
detailsActive = document.querySelectorAll("label.details__toggler--active");
for(var j = 0; j < detailsActive.length; j++) {
if(detailsActive[j].control.getAttribute("name") == parentInputName)
{
detailsActive[j].classList.remove("details__toggler--active");
}
}
this.classList.add("details__toggler--active");
}
else {
ldg_debug.log("Unchecked a details input for " + parentInputName);
this.classList.remove("details__toggler--active");
}
};
}
}