cmswalker / fullpage-react

Stateful fullpage.js inspired scrolling for React
https://cmswalker.github.io/fullpage-react/
206 stars 42 forks source link

Now working with domestic browsers #97

Closed thearnica closed 6 years ago

thearnica commented 6 years ago

Hey! Kudos for the library. It is the only "full page" for react, which actually works. Unfortunately - it does not work for all the cases.

To be more concrete - for vast majority of Chrome clones, which are chrome, but provide a different UserAgent.

Result is always the same - document.body is picked instead of document element, and scroll literally dies.

Would you consider using window.scrollTo, instead of scrollTop on some element? It could simplify the code, and works everywhere.

thearnica commented 6 years ago

For now I have to polyfill it

Object.defineProperty(document.body, 'scrollTop', {
  set: value => window.scrollTo(0,value),
  get: () => window.scrollY
});

And it works for me.

cmswalker commented 6 years ago

Hi Marina, thanks for finding a polyfill. I'll be sure to include this for the final patch. In the meantime please see https://github.com/cmswalker/fullpage-react/issues/90 as this will soon be deprecated

cmswalker commented 6 years ago

@thearnica please see #104. Under the new project all fullpage.js APIs are available for the react component