# Scroll position on back

**URL:** <https://forum.ionicframework.com/t/scroll-position-on-back/291>\
**Category:** ionic-v1\
**Created:** [December 19, 2013, 12:52pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291 "2013-12-19T12:52:11Z")\
**Posts on this page:** 17\
**Page:** 2

<div class="post-metadata">

**Author:** ![ethan](https://avatars.discourse-cdn.com/v4/letter/e/8dc957/32.png) [@ethan](https://forum.ionicframework.com/u/ethan)\
**Post date:** [February 6, 2014, 7:17pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/21 "2014-02-06T19:17:52Z")

</div>

Was the nightly meant to fix this problem when toggling the left/right side menus?

Calling `$scope.sideMenuController.toggleLeft();` causes the content pain to scroll to the top when toggling closed.

---

<div class="post-metadata">

**Author:** ![andy](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/andy/32/64157_2.png) [@andy](https://forum.ionicframework.com/u/andy)\
**Post date:** [February 6, 2014, 9:23pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/22 "2014-02-06T21:23:33Z")

</div>

That’s a bug, @ethan ! Could you open an issue?

You guys are awesome for finding all these 🙂

---

<div class="post-metadata">

**Author:** ![coen\_warmer](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/coen_warmer/32/64036_2.png) [@coen\_warmer](https://forum.ionicframework.com/u/coen_warmer)\
**Post date:** [February 7, 2014, 1:46pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/23 "2014-02-07T13:46:29Z")

</div>

This works great for me guys. Thanks.

---

<div class="post-metadata">

**Author:** ![ethan](https://avatars.discourse-cdn.com/v4/letter/e/8dc957/32.png) [@ethan](https://forum.ionicframework.com/u/ethan)\
**Post date:** [February 7, 2014, 10:16pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/24 "2014-02-07T22:16:03Z")

</div>

Sure @andytjoslin, issue opened - [https://github.com/driftyco/ionic/issues/557](https://github.com/driftyco/ionic/issues/557)

---

<div class="post-metadata">

**Author:** ![johndoe](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@johndoe](https://forum.ionicframework.com/u/johndoe)\
**Post date:** [February 8, 2014, 1:24pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/25 "2014-02-08T13:24:51Z")

</div>

I just wanted to point out, that the same thing sometimes happens when i close a modal.

---

<div class="post-metadata">

**Author:** ![bugmenot081](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bugmenot081](https://forum.ionicframework.com/u/bugmenot081)\
**Post date:** [March 24, 2014, 1:27am UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/26 "2014-03-24T01:27:45Z")

</div>

How about the list within the tabs? when I try to switch between the tab, the list always scroll to the top. Is possible to persist the position of list in tab?

---

<div class="post-metadata">

**Author:** ![kevincollins](https://avatars.discourse-cdn.com/v4/letter/k/a587f6/32.png) [@kevincollins](https://forum.ionicframework.com/u/kevincollins)\
**Post date:** [July 23, 2014, 10:24pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/28 "2014-07-23T22:24:48Z")

</div>

I’m having this problem - the view scrolls to the top when going back to it - despite it apparently being fixed according to this thread.

I’m running the latest (1.0.0-beta9). I’m new with Ionic, and would love to figure this one out if anyone has any ideas.

---

<div class="post-metadata">

**Author:** ![patrickrho](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@patrickrho](https://forum.ionicframework.com/u/patrickrho)\
**Post date:** [August 27, 2014, 6:06am UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/29 "2014-08-27T06:06:42Z")

</div>

is this broken? even though I am going back in history, the view is not remembering the scroll position

---

<div class="post-metadata">

**Author:** ![Anaphase](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@Anaphase](https://forum.ionicframework.com/u/Anaphase)\
**Post date:** [September 23, 2014, 2:00pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/30 "2014-09-23T14:00:51Z")

</div>

Just in case this is still an issue for anyone, I’ve modified @gregorypratt’s directive and it works perfectly for me:

Directive (apply to `<ion-content>` tag as attribute):

```
angular.module('App.directives')

.directive('keepScroll', [
  
  '$state'
  '$timeout'
  'ScrollPositions'
  '$ionicScrollDelegate'
  
  ($state, $timeout, ScrollPositions, $ionicScrollDelegate) ->
    restrict: 'A'
    link: (scope, element, attrs) ->
      scope.$on '$stateChangeStart', ->
        ScrollPositions[$state.current.name] = $ionicScrollDelegate.getScrollPosition()
      
      $timeout ->
        offset = ScrollPositions[$state.current.name]
        $ionicScrollDelegate.scrollTo offset.left, offset.top if offset?
  
])

```

Service (trivial, could easily be modified to use LocalStorage for cross-session persistence):

```
angular.module('App.services')

.factory('ScrollPositions', [
  
  -> {}
  
])

```

Sorry if CoffeeScript isn’t your thing, but you should be able to pick up the logic if you’re a vanilla JS kinda guy. I hope this helps someone!

---

<div class="post-metadata">

**Author:** ![itgoujie2](https://avatars.discourse-cdn.com/v4/letter/i/dfb087/32.png) [@itgoujie2](https://forum.ionicframework.com/u/itgoujie2)\
**Post date:** [May 7, 2015, 5:57pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/31 "2015-05-07T17:57:42Z")

</div>

Is there any version solved this by default ? I am using v1.0.0-rc.4-nightly-1257, still have this problem. Back to the list page will get the top of the list.

---

<div class="post-metadata">

**Author:** ![lucassimines](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/lucassimines/32/12851_2.png) [@lucassimines](https://forum.ionicframework.com/u/lucassimines)\
**Post date:** [May 16, 2015, 9:35pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/32 "2015-05-16T21:35:32Z")

</div>

I’m having the same problem, when I go back to my list it doesn’t remember the scroll position (this is issue not working on Android only)

---

<div class="post-metadata">

**Author:** ![Rautec](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@Rautec](https://forum.ionicframework.com/u/Rautec)\
**Post date:** [June 3, 2015, 10:48am UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/33 "2015-06-03T10:48:50Z")

</div>

Since the release version I have the problem, the scrollposition is not restored on back - **but only in the first displayed tab in the first view**. In all the other tabs and views everything is working fine on history back or when changing the tab, but the first displayed tab view does not restore the scroll position and I have no idea why.

It already worked with the RC versions. Has there something changed in the handling and restoring of scroll positions with the release version?

---

<div class="post-metadata">

**Author:** ![Lemos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/lemos/32/12624_2.png) [@Lemos](https://forum.ionicframework.com/u/Lemos)\
**Post date:** [June 9, 2015, 6:39pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/34 "2015-06-09T18:39:45Z")

</div>

Hello!  
I tested with the last version and it worked well.  
But it’s not working when I use overflow-scroll=“true” on the ion-content.

---

<div class="post-metadata">

**Author:** ![Lemos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/lemos/32/12624_2.png) [@Lemos](https://forum.ionicframework.com/u/Lemos)\
**Post date:** [June 9, 2015, 7:47pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/35 "2015-06-09T19:47:44Z")

</div>

It not works when I use overflow-scroll=“true” on the ion-content.

---

<div class="post-metadata">

**Author:** ![Karvapallo](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/karvapallo/32/78355_2.png) [@Karvapallo](https://forum.ionicframework.com/u/Karvapallo)\
**Post date:** [July 29, 2015, 8:05am UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/36 "2015-07-29T08:05:20Z")

</div>

Hey,

I kind of had a similar situation, but using the `overflow-scroll="true"` attribute. Here’s the thread:

> **[The ion-content with overflow-scroll doesn't maintain scroll position](http://forum.ionicframework.com/t/the-ion-content-with-overflow-scroll-doesnt-maintain-scroll-position/18734)**
>
> Hey guys! I was just wondering has anyone else noticed that when using ion-content with the native overflow-scroll set to true, when you navigate away and come back, the scroll position has been reset (to the top). This is seriously annoying and...

---

<div class="post-metadata">

**Author:** ![LouisR](https://avatars.discourse-cdn.com/v4/letter/l/9de053/32.png) [@LouisR](https://forum.ionicframework.com/u/LouisR)\
**Post date:** [January 6, 2016, 6:02pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/37 "2016-01-06T18:02:47Z")

</div>

Hey,

I have an in a `modal` in my app, and I would like to keep the scroll offset (position) for when the user comes back. Is it possible with a `modal` ?

Thanks

---

<div class="post-metadata">

**Author:** ![ceo\_don](https://avatars.discourse-cdn.com/v4/letter/c/34f0e0/32.png) [@ceo\_don](https://forum.ionicframework.com/u/ceo_don)\
**Post date:** [April 4, 2016, 6:54pm UTC](https://forum.ionicframework.com/t/scroll-position-on-back/291/38 "2016-04-04T18:54:52Z")

</div>

exactly what i needed, thank you!

[Previous page](https://forum.ionicframework.com/t/scroll-position-on-back/291.md?page=1)
