0
I’m having a problem, I looked on the Internet and did not find, I saw that there is a similar question here in Stack, but that did not solve my problem.
The thing is, I have several JS files, like for example one of "Show More", where he searches for more news, he picks up these upcoming news from another file that is the search.php, now what happens is this, some news has galleries that use JS, on the main page picks up correctly, but when I click Show More it shows the news but when I click to see the gallery does not work, to work I have to include that same JS in this page search.php, but it turns out that the page is a bit heavy, because it will have 2 equal JS that do the same function. Is that normal? JS does not take later files?
NOTE: I did not put the code here, because it is very large.
Put some part that you find interesting to show and pass the rest on the Pastebin.
– Mauro Alexandre
You have already tried to isolate the function or method that initializes the galleries to just run it again after loading.php.php?
– Enhardened
What do you mean? Isolate? I want it to work normally, but when you call fetch, it also works. That’s all
– Vinicius Henzel
You commented that you need to include javascript again to create the galleries. You could create a function to create these galleries that you just re-run, without having to include javascript again. Similar to the way Facebook renders like, share and comments components
– Enhardened
How would I create this function? The galleries were just one example...
– Vinicius Henzel