Hola Chicos.
Tengo el siguiente código preparado.
Código:
$(document).ready(function(){
var popped = ('state' in window.history && window.history.state !== null), initialURL = location.href;
var content = $('section');
var ajaxLoadPage = function (url) {
console.log('Loading ' + url + ' fragment');
content.load(url + '?fragment=true');
var zona = /home/.test(url);
console.log('Zona ' + zona);
if (zona = true) {
$(".menu li").removeClass("selectedLava");
$(".backLava").css("left","83px").css("width","51px");
$("section").delay(0).animate({height:"20px"}, {duration:700});
}
if (zona = false) {
$("section").delay(0).animate({height:"20px"}, {duration:700});
$("section").delay(700).animate({height:"160px"}, {duration:700});
}
}
var home = 'home';
history.pushState({page:home}, null, home);
$('a').not('[href^=http], [href^=https], [href^=#]').click(function(e){
e.preventDefault();
var href = $(this).attr('href');
ajaxLoadPage(href);
history.pushState({page:href}, null, href);
});
$(window).bind('popstate', function(event){
var initialPop = !popped && location.href == initialURL;
popped = true;
if (initialPop) return;
console.log('Popstate');
ajaxLoadPage(location.pathname);
});
});
Mi problema ocurre con las Animaciones de los objetos.
Resulta que ajax me cambia la url correctamente y me carga el contenido en "content", pero no procesa las animaciones.
El log de "zona" funciona correctamete y da true o false si detecta que estamos en home o no, pero no me hace las animaciones.
Alguna idea?.
Gracias.