From d71b5167fd8ae8a29f35426f37137af390e8b912 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Mon, 2 Mar 2015 16:29:05 +0100 Subject: [PATCH] Almost functionning dynamic nav history --- js/crep.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/crep.js b/js/crep.js index e8a5c38..6d6dd3b 100755 --- a/js/crep.js +++ b/js/crep.js @@ -20,7 +20,9 @@ function loadDoc(location) { $.get(location + '?c', function (data) { mainContainer = $("#mainContainer") mainContainer.html(data) - history.pushState({}, document.title, location) + history.pushState({ + loc: location + }, document.title, location) // POST dynamiseLinks(mainContainer) pageSpecific(location) @@ -28,9 +30,14 @@ function loadDoc(location) { } +function historyChange(ev) { + loadDoc(ev.state.loc) +} + $(document).ready(function () { dynamiseLinks(document) pageSpecific(window.location.href) + window.onpopstate = historyChange }) function initializeMap() { -- libgit2 0.21.2