I recently found this gist on how to Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo: https://github.com/browserstate/ajaxify
I am having a hard time getting a simple version of this working and am not sure I understand everything. First, I loaded all the scripts provided in the gist, then set up a really simple nav and content section:
<ul id="nav">
<li id="home-link"><a href="/" title="Home">Home</a>/</li>
<li id="work-link"><a href="/work" title="Work">Work</a>/</li>
<li id="labs-link"><a href="/labs" title="Labs">Labs</a>/</li>
<li id="blog-link"><a href="/blog" title="Blog">Blog</a>/</li>
<li id="contact-link"><a href="/contact" title="Contact">Contact</a></li>
</ul>
<div id="content"></div>
Next, I changed the selector variables to match the html:
/* Application Specific Variables */
contentSelector = '#content',
$content = $(contentSelector),
contentNode = $content.get(0),
$menu = $('#nav'),
activeClass = 'active',
activeSelector = '.active',
menuChildrenSelector = 'li',
What I'm supposed to do next is where I get lost. All I want to do is load in html content specific to the nav link selected. So if I clicked "Work", I would like to load a work.html file into the content section and change the url to "mywebsite.com/work". To keep things easy lets say work.html and all other ajaxable content is located in the same directory.
Any help is greatly appreciated! Cheers!