I have this code on my site js / pushstate.js:
$(document).ready(function() {
var nav, conteudo, fetchAndInsert;
//nav = $('div#navbar');
nav = $('.menu');
conteudo = $('#conteudo');
fetchAndInsert = function(href) {
$.ajax({
url: 'http://somdomato.com/cont/' + href.split('/').pop(),
method: 'GET',
cache: false,
success: function(data) {
conteudo.html(data);
}
});
};
$(window).on('popstate', function() {
fetchAndInsert(location.pathname);
});
nav.find('a').on('click', function(e) {
var href = $(this).attr('href');
history.pushState(null, null, href);
fetchAndInsert(href);
e.preventDefault();
});
});
/index.php:
<?php require 'inc/cabecalho.inc.php'; ?>
<div id="conteudo">
<?php require 'cont/index.php'; ?>
</div>
<?php require 'inc/rodape.inc.php'; ?>
The script works fine and pages load without the player to stop playing the song and the address changes as expected.
The problem is that when I switch from page to page all other scripts stop working.
The url is link Anyone have an idea of what might be happening?
Thank you.