Commit ff0121db authored by Jonas Heinrich's avatar Jonas Heinrich

start implementing popstate event

parent 204addb7
...@@ -18,8 +18,6 @@ $('body').on('click','.btn, .nav-item, logo, .video-item', function(e) { ...@@ -18,8 +18,6 @@ $('body').on('click','.btn, .nav-item, logo, .video-item', function(e) {
url = $this.attr("href"); url = $this.attr("href");
} }
alert(url);
load_page(url); load_page(url);
return false; return false;
...@@ -27,14 +25,12 @@ $('body').on('click','.btn, .nav-item, logo, .video-item', function(e) { ...@@ -27,14 +25,12 @@ $('body').on('click','.btn, .nav-item, logo, .video-item', function(e) {
}); });
function load_page(url) { function load_page(url) {
$("content").empty(); $("content").empty();
$("content").hide().load(url).fadeIn('fast'); $("content").hide().load(url).fadeIn('fast');
//window.history.pushState({href: url}, '', url); window.history.pushState('', '', url);
} }
window.addEventListener('popstate', function(e){ window.onpopstate = function(event) {
if(e.state) load_page(location.pathname);
load_page(e.state.href); };
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment