Clicking on a div inside a sidebar I load a specific file inside a div.
<div id="menuLeft">
<div id="file01">File 01</div>
<div id="file02">File 02</div>
<div id="file03">File 03</div>
</div>
js
$("#menuLeft div").click(function () {
var id = "chapters/" + $(this).attr('id') + ".php";
$('#divRight').load(id);
});
This all works, but url is always the same - for example www.something.com
What I need by clicking on the sidebar is to get something like www.something.com#file01, or any other content, so when this url is entered in another window, file01 is automatically loaded inside divRight.
Any help?
location.hash. If it's set, then strip off the leading#and call.load().#file01,file02. Then just remove the#and use.split(',').