From f9bf7ccb46ad987ecb4ece3107d11e6a5d976db2 Mon Sep 17 00:00:00 2001 From: Rhiannon Morris Date: Tue, 4 Aug 2020 22:55:33 +0200 Subject: [PATCH] fix single.js --- script/single.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/script/single.js b/script/single.js index 7e1f885..1d80fa9 100644 --- a/script/single.js +++ b/script/single.js @@ -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); }; }