Skip to content

Instantly share code, notes, and snippets.

@woeye
Created November 25, 2011 09:42
Show Gist options
  • Save woeye/1393148 to your computer and use it in GitHub Desktop.
Save woeye/1393148 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
</head>
<body>
<div id="marker"></div>
<script>
YUI().use('node', 'history', function(Y) {
var m = Y.one('#marker');
var history = new Y.HistoryHTML5();
for (i=0; i<10; i++) {
history.add({
step: 'step_' + i
}, {
title: 'Step ' + i,
url: document.location.pathname + '?step=' + i
});
//document.title = 'Testing | Step ' + i;
m.setContent('hello world: ' + i);
}
history.on('stepChange', function(e) {
console.log('history changed!');
m.setContent('back in time: hello world: ' + e.newVal);
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment