JSFiddle - React, Tailwind, and code Playground
by mowglisanu
HTML
<a href="#one">One</a>
<a href="#two">Two</a>
<a href="#three">Three</a>
<a href="#four">Four</a>
<a href="#five">Five</a>
<a href="#six">Six</a>
JavaScript
$('a').on('click', function(){
var val = $(this).text();
if ('pushState' in history){
history.pushState({page:val}, "page 2", val+".html");
return false;
}
});
$(window).on('popstate', function(e){
console.log(e.originalEvent.state && e.originalEvent.state.page);
})
.on('hashchange', function(e){
console.log(e);
});
$(function(){
console.log('load');
});