I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (
</>) will also add backticks around text.
Note: Backticks are not single quotes.
Also you are more likely to get a good response if you explain what the issue is and put what you have up somewhere other people can run it, like CodePen. You are asking a great deal of people to be able to read through this vast wall of text to figure out what is wrong.