zenscroll icon indicating copy to clipboard operation
zenscroll copied to clipboard

True zen recognizes the relativity in all things

Open KurtPreston opened this issue 7 years ago • 4 comments

Hey, great package! Recently noticed an issue where zenscroll will not successfully scroll to any element contained in a position: relative div.

Demo here: http://requirebin.com/?gist=ae3708359c2ad71651d03fb9bdfc9115

In it, you will see three buttons. The second one will not work because div b is contained inside a div with position: relative, and will instead scroll to the top of the container div.

KurtPreston avatar Aug 14 '17 20:08 KurtPreston

Thank you very much for reporting it, especially that you prepared an example. I am looking into it.

Great subject by the way! :)

zengabor avatar Aug 26 '17 11:08 zengabor

Its because the library is made to use elem.offsetTop. But you should change it to walk up the given element's parents until it reaches the zenscroll container. Is the fix planned any time soon?

pitAlex avatar Jan 09 '18 22:01 pitAlex

One Eternity Later

TiagoPortfolio avatar Aug 23 '19 10:08 TiagoPortfolio

You are right, and sorry about that. I was hoping that eventually all major browsers implement smooth scrolling, which is preferred over a custom JavaScript solution. Fortunately, this has happened since then.

zengabor avatar Jul 09 '22 15:07 zengabor