Skip to content

Instantly share code, notes, and snippets.

@ynonp
Last active December 20, 2015 08:58
Show Gist options
  • Save ynonp/6103835 to your computer and use it in GitHub Desktop.
Save ynonp/6103835 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
.page { display: none }
.active.page { display: block }
</style>
</head>
<body>
<div id="page1" class="active page">
<ul>
<li><a href="#page_camera">Camera</a></li>
</ul>
</div>
<div id="page_camera" class="page">
<a href="#page1">Back</a>
<h1>Camera</h1>
<p>A great camera</p>
<b>Price: </b>20$
</div>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="app.js"></script>
</body>
</html>
(function() {
var go_to_page = function( page ) {
$('.page').removeClass('active');
$(page).addClass('active');
};
window.addEventListener('hashchange', function() {
var href = window.location.hash;
go_to_page( href );
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment