Last active
December 20, 2015 08:58
-
-
Save ynonp/6103835 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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