Zero window.scrollY or document.body.scrollTop on pages like that from the tutorial

1,901 views
Skip to first unread message

Sid Kat

unread,
Sep 8, 2014, 1:32:38 PM9/8/14
to polym...@googlegroups.com
It seems that you cannot get the scroll state of a page like that from the tutorial http://www.polymer-project.org/apps/polymer-tutorial/finished/.
I've encountered the same issue with a similar page where most of the content goes into one custom polymer element.
Scrolling up and down does not change document.body.scrollTop or window.scrollY (or whatever), they are always 0.
And button events on such pages do not distinguish between pageY, clientY, screenY and y.

cletusw

unread,
Sep 8, 2014, 2:02:15 PM9/8/14
to polym...@googlegroups.com
That's because the page isn't scrolling. An internal element of core-header-panel is. Current versions of core-header-panel include a scroller property that gives you access to the element on which you can get the correct scrollTop. Looks like http://www.polymer-project.org/apps/polymer-tutorial/finished/ is using an old one, so it doesn't have that.

Sid Kat

unread,
Sep 8, 2014, 2:59:33 PM9/8/14
to polym...@googlegroups.com
Ah, thank you!

arthure

unread,
Sep 12, 2014, 7:40:35 PM9/12/14
to polym...@googlegroups.com
Thanks for pointing that out! The actual tutorial repo is using the correct version. The next website build should pick up the correct version of the tutorial.

Thanks,
Arthur

Sid Kat

unread,
Sep 13, 2014, 8:39:13 PM9/13/14
to polym...@googlegroups.com
The docs for the core-scroll-header-panel should also list the scroller property.


Am Montag, 8. September 2014 20:02:15 UTC+2 schrieb cletusw:
Reply all
Reply to author
Forward
0 new messages