Skip to content

Instantly share code, notes, and snippets.

@heyjinkim
Last active December 23, 2015 02:09
Show Gist options
  • Save heyjinkim/6564547 to your computer and use it in GitHub Desktop.
Save heyjinkim/6564547 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ember Starter Kit</title>
<link rel="stylesheet" href="https://rawgithub.com/emberjs/starter-kit/v1.0.0/css/normalize.css">
<style>
html, body {
margin: 20px;
text-align: center;
}
div.box {
background-color: #f8f8ff;
height: 600px;
margin: 100px 0px;
}
</style>
</head>
<body>
<script type="text/x-handlebars">
{{outlet}}
</script>
<script type="text/x-handlebars" id="index">
<h1>Index</h1>
<div class="box"></div>
{{#linkTo 'show'}}If you click in the middle of the page, you will see blank screen{{/linkTo}}
<div class="box"></div>
{{#linkTo 'show'}}If you click at the bottom of the page, scrolling to the top{{/linkTo}}
</script>
<script type="text/x-handlebars" id="show">
<h1>Show</h1>
{{#linkTo 'index'}}index{{/linkTo}}
</script>
<script src="https://rawgithub.com/emberjs/starter-kit/v1.0.0/js/libs/jquery-1.9.1.js"></script>
<script src="https://rawgithub.com/emberjs/starter-kit/v1.0.0/js/libs/handlebars-1.0.0.js"></script>
<script src="https://rawgithub.com/emberjs/starter-kit/v1.0.0/js/libs/ember-1.0.0.js"></script>
<script>
App = Ember.Application.create();
App.IndexRoute = Ember.Route.extend({});
App.Router.map(function() {
this.resource('show');
});
// Remove this comment if you want to see the fix
/*
Ember.Router.reopen({
didTransition: function(infos) {
this._super(infos);
Ember.run.next(function () {
window.scrollTo(0, 0);
});
}
});
*/
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment