I change the URLs of my sites to / name using History.pushState, which works, but the page does not view the location of the site where it is supposed to be.
index.php:
<nav> <ul> <li><a href="#work">Work</a></li> <li><a href="#about">About</a></li> <li><a href="#services">Services</a></li> <li>Blog </li> <li><a href="#contact">Contact</a></li> </ul> </nav> <article class="content" id="work"> ... <article class="content" id="about"> ...
jquery.page.js:
_saveState = function( chapter ) { if (History.getState().url.queryStringToJSON().chapter !== chapter) { var page; if (chapter == 1) page = "/work"; if (chapter == 2) page = "/about"; if (chapter == 3) page = "/services"; if (chapter == 4) page = "/blog"; if (chapter == 5) page = "/contact"; else page = '?chapter=' + chapter; History.pushState(null, null, page) } }, ... _goto = function( chapter ) { var chapter = chapter || History.getState().url.queryStringToJSON().chapter, isHome = ( chapter === undefined ), $article = $( chapter ? '#' + 'chapter' + chapter : '#' + 'introduction' ); ...
When a user clicks on a link in the navigation menu, how can I make the page go to the place that she suggested, as shown in the tutorial ? Do I follow him?
source share