1
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 normally and the pages are loaded without the player stopping playing the music and the address changes as expected.
The problem is that when I switch from one page to another all other scripts stop working.
The url is http://somdomato.com Does anyone have any idea what might be going on?
Thank you.
I tried to do this: http://answall.com/a/117454/7759 but I didn’t understand the procedure very well, and I don’t think it worked.
– sistematico