Commit d71b5167fd8ae8a29f35426f37137af390e8b912

Authored by Geoffrey PREUD'HOMME
1 parent dcc55bea

Almost functionning dynamic nav history

Showing 1 changed file with 8 additions and 1 deletions   Show diff stats
js/crep.js
... ... @@ -20,7 +20,9 @@ function loadDoc(location) {
20 20 $.get(location + '?c', function (data) {
21 21 mainContainer = $("#mainContainer")
22 22 mainContainer.html(data)
23   - history.pushState({}, document.title, location)
  23 + history.pushState({
  24 + loc: location
  25 + }, document.title, location)
24 26 // POST
25 27 dynamiseLinks(mainContainer)
26 28 pageSpecific(location)
... ... @@ -28,9 +30,14 @@ function loadDoc(location) {
28 30  
29 31 }
30 32  
  33 +function historyChange(ev) {
  34 + loadDoc(ev.state.loc)
  35 +}
  36 +
31 37 $(document).ready(function () {
32 38 dynamiseLinks(document)
33 39 pageSpecific(window.location.href)
  40 + window.onpopstate = historyChange
34 41 })
35 42  
36 43 function initializeMap() {
... ...