My code is not flawed in any way
Actually, yes it is…in many ways.
Frankly, though, I think you have so many issues and a such knowledge/experience gap that this subject is bigger than can be addressed here.
My advice, for what it’s worth, is to narrow this down to one issue at a time.
Pick one thing…decide what you want to do…fix that…then move on to the next thing.
We’re all just people on the interwebz, some of us have some free time we can dole out in limited amounts and, I’ll be frank, what you have here is, perhaps more than we’re willing to take on. Just being up front here.
Small bites would be preferred.
Oh, and if you want to demo code, we prefer that, if possible you use sites like Codepen.io or JSfiddle.net where we can fork it and play with it to get it right.
It’s a lot easier to do that tham keep referencing a live site.