+ 2

js error when slides in carousel is duplicated after changing web tab

- I get an error in the console whenever I minimize my browser while my project runs it always shows the error: "Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. at HTMLDivElement.<anonymous>" - With this error, my oldest slides are not deleted and new slides continue to be created. +You can change "overflow: hidden" in ".carousel-content" to "overflow: visible" to see the error - Here is the link: https://code.sololearn.com/WFsuwE16wpZp Sorry my code looks messy. I still have a lot to learn

26th Nov 2021, 5:54 AM
MasterofBeginning
MasterofBeginning - avatar
4 ответов
0
Don't name functions with capital letters. Although such functions absolutely valid, there is naming convention to use capital letters only for function constructors.
27th Nov 2021, 4:54 AM
Artur
Artur - avatar
0
Always wrap your code in window.onload or attach DOMContentLoaded event listener to document right from the beginning, unless you really know what you're doing. In your code you defined a bunch of variables and assigned DOM elements to them while your DOM isn't loaded.
27th Nov 2021, 5:05 AM
Artur
Artur - avatar
0
I appreciate you taking the time to help me troubleshoot but the error seems to persist when I try minimizing the browser or switching tabs
27th Nov 2021, 9:58 AM
MasterofBeginning
MasterofBeginning - avatar