iamdustan / smoothscroll

Scroll Behavior polyfill
http://iamdustan.com/smoothscroll/
MIT License
3.85k stars 340 forks source link

Cannot scroll center for scrollIntoView in iOS #178

Open imjeen opened 3 years ago

imjeen commented 3 years ago

use native API scrollIntoView and make someone element scrolling to center, see Demo in codepen in Safari.

Element.scrollIntoView({
    behavior: 'smooth',
    inline: 'center'
 });

the polyfill cannot make it center in Safari, it looks like only for inline: 'sart'

davebalmer commented 3 years ago

Nice polyfill! I'd like to see block: 'center' and block: 'nearest' work as well.

rdowner22 commented 3 years ago

I am also experiencing this issue for X axis smoothscroll for all browsers on iOS (Safari, Chrome & Firefox). Currently all is functioning on Android, MacOS, and Windows.

scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' })

Same behavior as the CodePen linked in original post with block: 'center'

Live Example Link for Mobile - https://ryansrealty.idxstaging.com/idx/market-reports/a001/city/springfield-oregon Recently Sold Section -> Click on a black circle pin on the map.

Video Example of behavior - https://drive.google.com/file/d/1VAm1yu7hXbYEybGrTwVSPGJFkHJlW60P/view?usp=sharing

Expected: Element will be in the center of the viewport of the device.

CarryOnHxy commented 2 years ago

damn, i hope it will work

angelbeatsying commented 2 years ago

how to resolve it...