0
I am developing a website and for page transitions, using $.get() from Jquery and modifying only the center of index.html, without the page reloading. However, some features of the code snippets that I include require scripts, which are also used in index.html, but for them to work, I must include them again in the code snippet that I’m including. I got a big problem with that, 'cause there’s been some conflict.
An example: I use a script to make something in my header work. The moment I include in index.html a chunk of code (coming from a $.get() at runtime) that will also use this same script, it does not "take" this script, so I have to include it separately (and repeatedly). However, when I include, there is conflict, as repetition of effects and the like.
What should I do to not have to do this?
EDITED:
Upon request, I place parts of the code that are having conflict.
INDEX.HTML
<!doctype html>
<html>
<head>
...
...
</head>
<body>
<div class="conteudo">
<!-- AQUI É ONDE É SUBSTITUIDO O TRECHO PUXADO PELO $.get() -->
</div>
</body>
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.bxslider.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script src="js/owl.carousel.js"></script>
<script src="js/modernizr.js"></script>
<script type="text/javascript" src="js/skrollr.min.js"></script>
<script src="js/functions.js"></script>
<script src="controller/controle.js"></script> <!-- SCRIPT RESPONSÁVEL POR CONTROLAR O MENU E LEVAR OS TRECHOS DE CÓDIGO PARA A DIV CONTEUDO -->
</html>
Having index.html, shown above, I have files. html, such as "principal.html", "contato.html", which are called by this code snippet in.js control
$.get("view/principal.html", function(view){
$("#conteudo").html(view);
});
Paging works perfectly, however, if any elements coming from the next files use any of the index.html scripts, they don’t take. To do this, I have to add this snippet to all the . html I add to the div content:
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.bxslider.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script src="js/owl.carousel.js"></script>
<script src="js/modernizr.js"></script>
<script type="text/javascript" src="js/skrollr.min.js"></script>
<script src="js/functions.js"></script>
However, when I add this excerpt, "fixed" functionalities of index.html, which use the scripts of index.html itself, begin to have conflicts, such as repetition of effects and not functioning of some functionalities.
What are the conflicts? your question is not clear
– Marcelo Bonus
Hello Rene! Welcome to Stack Overflow! In order for the community to help you, it is important to explain your problem in detail. If you can include snippets of code, great! If it can be executed, even better! Read more here. Further information on how to ask and answer is available at Help center.
– Daniel
You can tell which scripts give conflict and what functionality they do?
– Sergio
Friends, the codes have been added. Thank you very much!
– René Gustavo
The codes have been added guys
– René Gustavo