When I go to some site page and try to run the functional script, it only works when I give f5, ie it does not work with .load in a div.
JS
$(document).ready(function(){
var content = $('#content');
$('a').live('click', function( e ){
e.preventDefault();
$("html, body").animate({
scrollTop: $("#content").offset().top
}, 300);
content.html( '<div class="loading"></div>' );
var href = $( this ).attr('href');
$.ajax({
url: href,
success: function( response ){
var response = $( '<div>'+response+'</div>' );
var data = response.find('#content').html();
window.setTimeout( function(){
content.fadeOut('slow', function(){
content.html(data).fadeIn();
var title = response.find('title').text();
window.history.pushState( href, title, href );
document.title = title;
});
}, 500 );
}
});
});
});
HTML PART
//head, meta, links do js e css
<body>
//conteudo
<div id="content">
//conteudo carregado
</div>
</body>