Index: static/js/main.js |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/static/js/main.js |
@@ -0,0 +1,27 @@ |
+(function(){ |
+ document.addEventListener("DOMContentLoaded", function() { |
juliandoucette
2017/08/22 14:33:42
NIT: We are supposed to put brackets on the next l
ire
2017/09/04 20:28:06
Done.
|
+ |
+ // Change html class name from "no-js" to "js" |
+ document.documentElement.className = "js"; |
+ |
+ // Custom Select |
+ var customSelects = document.getElementsByClassName('custom-select-selected'); |
+ function onClickCustomSelect(e) { |
+ var options = e.target.nextElementSibling; |
+ if (options.getAttribute("aria-hidden") == "true") |
+ { |
+ options.removeAttribute("aria-hidden"); |
+ e.target.setAttribute("aria-expanded", "true"); |
+ } |
+ else |
+ { |
+ options.setAttribute("aria-hidden", "true"); |
+ e.target.setAttribute("aria-expanded", "false"); |
+ } |
+ } |
+ for (var i = 0; i < customSelects.length; i++) { |
+ customSelects[i].addEventListener("click", onClickCustomSelect, false); |
juliandoucette
2017/08/22 14:33:41
NIT: We could handle this event on the body instea
ire
2017/09/04 20:28:06
Agreed. I would like to change the way both this a
juliandoucette
2017/09/06 17:48:19
Acknowledged.
|
+ } |
+ |
+ }, false); |
+}()); |