Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Problem in small screens #18

Open
Eduardo-Julio opened this issue Jan 17, 2017 · 2 comments
Open

Problem in small screens #18

Eduardo-Julio opened this issue Jan 17, 2017 · 2 comments

Comments

@Eduardo-Julio
Copy link

Eduardo-Julio commented Jan 17, 2017

Hi,

I have a fixed element inside a scrollable container, to make this work I had to put "ui-scrollpoint-target" in the container. This works great in a desktop.

The problem is, when the page is in a mobile screen size, the container no longer controls the scroll, now the body is controlling the scroll and the fixed element doesn't work, probably because is listening to the "ui-scrollpoint-target" of the container that is no longer controlling the scroll.

Any advice on this? Thanks!

@plong0
Copy link
Contributor

plong0 commented Jan 19, 2017

W3 standards state that fixed element position is relative to the viewport, not to a scrollable container. While you might find that it works on certain browsers, you should definitely not rely on it to be cross-compatible.

What I've done in the case of having an element "stick" to the top of a scrollable div is to set its position: absolute; and watch the scroll event on the scrollable div (potentially a ui-scrollpoint-target) to update the element's top value.

You probably could try the ui-scrollpoint-pin module. Last I recall it was working pretty nicely, but I ended up abandoning the project because I found it to be overkill and I wrote something more specialized into my ui framework.

@Eduardo-Julio
Copy link
Author

Thanks for your help.

Yes, as I said, the sticky element is working with ui-scrollpoint-target, the problem is when that container is no longer controlling the scroll because the screen size is too small and the whole page/body starts controlling the scroll.

I haven't found something to explain how ui-scrollpoint-absolute works, maybe that can help?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants