Files
kit/assets/jquery/history/examples/app.html
T
2024-12-20 06:04:35 +03:00

58 lines
842 B
HTML

<!DOCTYPE html><html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/yeikos/jquery.history/jquery.history.js"></script>
<script>
$(function() {
$.history.on('load change push pushed', function(event, url, type) {
alert(event.type + ': ' + url);
}).listen('hash');
$('body').on('click', 'a', function(event) {
$.history.push($(this).attr('href'));
event.preventDefault();
});
$('button').click(function() {
location.reload();
});
});
</script>
</head>
<body>
<ul>
<li><a href="/one">one</a></li>
<li><a href="/two">two</a></li>
<li><a href="/three">three</a></li>
<li><a href="/four">four</a></li>
</ul>
<button>refresh</button>
</body>
</html>