function ajaxUrl(href){ $(document).scrollTop('0'); $('#loades').css({'display':'block'}); $('html').css('overflow','hidden'); $.post( href, {'ajaxes_loaders' : null}, function (data){ $('#loades').css('display','none'); $('html').css('overflow','auto'); $('html').html(data); } ); } if (history.pushState){ $(window).on('popstate', function(event){ var loc = event.location || ( event.originalEvent && event.originalEvent.location )|| document.location; ajaxUrl(loc.href); }); $(document).on('click', 'a[load != "none"]', function(e){ var href = $(this).attr('href'); if (href != null){ ajaxUrl(href); var titl = $('div[title]').text(); document.title = titl; history.pushState(href, titl, href); e.preventDefault(); } }); }