fix single.js

This commit is contained in:
Rhiannon Morris 2020-08-04 22:55:33 +02:00
parent 7de35a098f
commit f9bf7ccb46

View file

@ -1,9 +1,9 @@
(function() {
'use strict';
let mainfig = document.getElementById('mainfig');
let mainimg = document.getElementById('mainimg');
let mainlink = document.getElementById('mainlink');
let mainfig;
let mainimg;
let mainlink;
function openCW(caption, focusLink) {
mainfig.removeChild(caption);
@ -48,6 +48,10 @@ function activateButton(button) {
}
function setup() {
mainfig = document.getElementById('mainfig');
mainimg = document.getElementById('mainimg');
mainlink = document.getElementById('mainlink');
for (let button of document.querySelectorAll('#alts input')) {
button.onchange = e => { if (button.checked) activateButton(button); };
}