diff --git a/src/index.js b/src/index.js index fca8a6f..68d6bfa 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,8 @@ -import htmx from 'htmx.org'; +import 'htmx.org'; import '/src/htmx_import.js' import AudioMotionAnalyzer from 'audiomotion-analyzer'; -htmx.onLoad(function(target) { + +addEventListener("load", (_event) => { const container = document.getElementById('audioContainer'); const audioSource = document.getElementById('player'); const audioMotion = new AudioMotionAnalyzer(container, { source: audioSource }); @@ -17,6 +18,6 @@ htmx.onLoad(function(target) { function drawCallback(instance, _info) { const energy = instance.getEnergy() * 150; - target.style.setProperty('--energy', energy + 'px'); + document.documentElement.style.setProperty('--energy', energy + 'px'); } });