Verified Commit 41962a19 authored by Thibaut Broggi's avatar Thibaut Broggi
Browse files

Add default tab using javascript

    Buttons "next" and "previous" now change the active tab using javascript
parent aaadffc9
...@@ -74,7 +74,6 @@ for (let i = 0; i < bgColorElems.length; ++i) { ...@@ -74,7 +74,6 @@ for (let i = 0; i < bgColorElems.length; ++i) {
} }
document.getElementById('step2value').oninput = draw; document.getElementById('step2value').oninput = draw;
document.getElementById('signature').oninput = draw; document.getElementById('signature').oninput = draw;
window.onload = draw;
let navElems = document.querySelectorAll('nav > a'); let navElems = document.querySelectorAll('nav > a');
for (let i = 0; i < navElems.length; ++i) { for (let i = 0; i < navElems.length; ++i) {
...@@ -85,3 +84,16 @@ for (let i = 0; i < navElems.length; ++i) { ...@@ -85,3 +84,16 @@ for (let i = 0; i < navElems.length; ++i) {
e.target.classList.add('active-tab'); e.target.classList.add('active-tab');
} }
} }
let navButtons = document.querySelectorAll('.prevButton, .nextButton');
for (let i = 0; i < navButtons.length; ++i) {
navButtons[i].onclick = function(e) {
document.querySelector('nav > a[href="' + e.target.attributes.href.value + '"]').click();
}
}
window.onload = function() {
draw();
let hash = window.location.hash || '#step1';
document.querySelector('nav > a[href="' + hash + '"]').click();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment