Reputation: 43
I'm using ember v2.5.0. I want my images page to scroll me where I was before going to details page when I hit the "back" link.
I found this about the problem :
https://dockyard.com/blog/2014/05/05/preserve-scroll-position-in-ember-apps
But when I try to include it in my project, it gives me error
routes/index.js: line 130, col 29, 'opts' is defined but never used.
routes/index.js: line 154, col 13, 'position' is defined but never used.
routes/index.js: line 155, col 13, 'viewportHeight' is defined but never used.
Also, in the code it says ThingsView
at the end and I dont know what to write there because I'm using a list not a view.
This is my twiddle :
https://ember-twiddle.com/d88e8e6402b6a437746f3adb5cab85f0?openFiles=router.js%2C
Can anyone help me integrate this into my project or offer me something else? I'm stucked with this. Thanks.
Upvotes: 0
Views: 399
Reputation: 12872
Introduced currentPos property in index controller. and changed this value when scroll event occurs(followed link provided by you). We need to execute the below line on didInsertElement hook,
Ember.$(window).scrollTop(this.getWithDefault('currentPos', 0));
You please have a look at the sample ember-twiddle
Upvotes: 1
Reputation: 1057
These are not errors. actually these are warning about unused variables or properties. if your code is running well than you can ignore them, or delete all those variables which are not using in your application
Upvotes: 1