The ion-scroller is based on the zynga scroller, which really just movies content inside the scroller. Technically, it’s not scrolling, but just moving the content inside. That being said, css positioning fixed won’t work, you may have to use position: absolute;
I’m trying to get an element to remain static at the top of the screen below the header (same effect on the facebook app used to prompt the user that there are new items in the feed).
Edit: is it possible to detect what position the user is within the scroller so I could set the position of the element to that?
Well if its a facebook-like feed, you could always just scroll to the top. But to get the position of something with in a scroller, you can use the .getScrollPosition() method. Note that this only works in the nightly builds thought
Hi Boffy. If I’m understanding your question correctly, I think the solution is to put your fixed element outside of the scrolling content container. Something along these lines.
<ion-view class="wrapper">
<div class="bar bar-header">
fixed stuff goes here
</div>
<ion-content scroll="true" class="has-header">
scrolling stuff goes here
</ion-content>
</ion-view>
I’ve stumbled upon this post, and I know that it’s years later but I had this issue recently where I couldn’t use position: fixed to make anything sticky.
So go to global.scss and simply place this:
.ion-page{
contain: initial;
}
This was very simple and fixed the issue instantly for me. I also have overflow-y: scroll on ion-page.