T
T
Trafalgar2022-04-19 19:00:10
JavaScript
Trafalgar, 2022-04-19 19:00:10

Why can Js scripts stop working?

Hello. Please tell me what I need to google to fix this problem.

I have an online store website, I connect a js cart there, add a js script to the base template and the cart works, but another js script responsible for switching between categories stops working and the burger stops dropping out in the mobile version

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Levsha1337, 2022-04-19
@Levsha1337

In theory, a script can use variables from the global scope (window). You can try wrapping the scripts in self-executing functions, this can help, although the chance is very small. If it does not help, you need to look at the scripts themselves in more detail.

(function () {
// ... код
})()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question