GithubHelp home page GithubHelp logo

Comments (5)

markcellus avatar markcellus commented on June 6, 2024

Hey! Thanks for using the package and for your contribution. The problem is that the package detects current scroll position by evaluating document.body.scrollTop. But doesn't consistently return the correct scroll distance and is discouraged in modern browsers (in strict mode anyway).

To quickly fix this for your use case, just pass document.documentElement to the Scroll constructor instead of document.body.

new Scroll(document.documentElement);

and that should do the trick! Let me know if that works.

from scroll-js.

markcellus avatar markcellus commented on June 6, 2024

@crs1138 I've opened #27 to fix this issue. Do you mind pulling that down and verifying that it fixes your issue?

from scroll-js.

markcellus avatar markcellus commented on June 6, 2024

@crs1138 there seems to be a problem with your example. all of the grid-items are absolutely positioned and the parent element (<body> in your example) has no overflow content. Per README, your parent element needs to always have overflow content.

In addition to that, I suspect there is something being done to the elements in the other JS files that is causing your page to redraw back to 0 in height.

Either way, i'm not able to reproduce on the scroll-to-element demo, which seems to work fine even when clicking an elements further down on the page.

Going to close this for now, but if you are able to remove the additional JS files and reproduce the issue using only this package, that will give me something concrete to help fix your issue.

from scroll-js.

crs1138 avatar crs1138 commented on June 6, 2024

It is the combo of using it with Isotope2 that has been crucial to my project as I was looking for a way to bring focus to an expanded grid item. Without that, there's no need for the scrolling. Yes, Isotope positions absolutely all the items and I should have read your readme instruction more carefully. Thanks for the time you put in.

from scroll-js.

mraerino avatar mraerino commented on June 6, 2024

I'm still experiencing this with 1.9.1 - therefore I opened #28
Unfortunately using document.documentElement will not work on Safari...
Feel free to close my duplicate and reopen this.

from scroll-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.