From 2cd055553b61909703850ff780e852c47bc0c749 Mon Sep 17 00:00:00 2001 From: Mhykol Date: Sun, 16 Jun 2024 23:07:37 -0400 Subject: Added examples for assets --- examples/assets/js/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 examples/assets/js/index.js (limited to 'examples/assets/js/index.js') diff --git a/examples/assets/js/index.js b/examples/assets/js/index.js new file mode 100644 index 0000000..32e8cf5 --- /dev/null +++ b/examples/assets/js/index.js @@ -0,0 +1,22 @@ +class Index { + constructor() {} + + Init() {this.#EventListener()} + + #EventListener() { + const about = document.getElementById('index-about') + const readBlogs = document.getElementsByClassName('index-readblogs') + const websites = { + helpinghands: document.getElementById('helpinghands'), + goodhandhauling: document.getElementById('goodhandhauling') + } + + for (let i = 0; i < readBlogs.length; i++) readBlogs[i].addEventListener('click', () => window.location.href = '/blog') + + about.addEventListener('click', () => window.location.href = '/about') + websites.helpinghands.addEventListener('click', () => window.location.href = 'https://helpinghandsadultcare.org/') + websites.goodhandhauling.addEventListener('click', () => window.location.href = 'https://goodhandhauling.com/') + } +} + +new Index().Init() -- cgit v1.2.3-70-g09d2