JSFiddle - React, Tailwind, and code Playground
HTML
<div class="links">
<a href="#ajax">Load HTML</a>
</div>
<div class="main">
<div class="sliderContent">Click above url to load content</div>
</div>
CSS
html, body {
margin: 0;
overflow: hidden;
}
.links {
width: 100%;
background: lightgrey;
padding: 20px;
}
.sliderContent {
height: 500px;
width: 500px;
margin: 50px;
background: lightgrey;
}
JavaScript
$(document).ready(function(){
var router = {
"#ajax" : "http://fiddle.jshell.net"
};
$(window).on("hashchange", function(){
var route = router[location.hash];
if (route === undefined) {
return;
}
else {
$.get( route, function( data ) {
$( ".sliderContent" ).html( data );
});
}
});
});