1
When I go to some page of the site and try to run the functional script, it only works when I give F5, IE, it does not work with . load on 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 );
}
});
});
});
PART OF HTML
//head, meta, links do js e css
<body>
//conteudo
<div id="content">
//conteudo carregado
</div>
</body>
You’re making
$("#content")
and has<div class="content">
. Would not be$(".content")
or else<div id="content">
– Pagotti
This, I’ll edit, this right in my file, only here I didn’t notice it
– Hanz
The links are within
#content
?– Oeslei
Yes, those outside, the load does not work.
– Hanz