From 5e09053c124d031b0293c2e8ee2778bc7e578101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuzhan=20Ero=C4=9Flu?= Date: Tue, 12 Feb 2019 08:48:46 +0000 Subject: [PATCH] switch to addEventListener --- index.html | 2 +- js/nodes.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 2b6d279..cc22ee2 100644 --- a/index.html +++ b/index.html @@ -102,7 +102,7 @@
nodes.js -
v1.1
+
v1.2
HTML5 Canvas nodes/particles animation with Javascript diff --git a/js/nodes.js b/js/nodes.js index 57385ac..1a08dba 100644 --- a/js/nodes.js +++ b/js/nodes.js @@ -49,7 +49,8 @@ var NodesJs = (function (parameters) { } }; - document.body.onload = function () { + window[window.addEventListener ? 'addEventListener': 'attachEvent'] + (window.addEventListener ? 'load': 'onload', function () { canvas = document.getElementById(t_NodesJs.id); ctx = canvas.getContext('2d'); @@ -135,5 +136,5 @@ var NodesJs = (function (parameters) { }; step(); - }; + }); });