Skip to content

document.body no longer seems to work on Chrome & firefox. #19

@moehammoud

Description

@moehammoud

So it seems that using the element document.body no longer works on Chrome and Firefox. It still works just fine on Safari and IE.
The fix for Chrome seems to be using document.documentElement instead of document.body. The issue now is that the fix no longer works in Safari. I can include a simple if else statement to ensure each browser has a valid animatedScrollTo function called, but I wonder if there is a more elegant solution that could be used or included in the animatedScrollTo library.

Example of my animateScrollTo call after syntax change.

animatedScrollTo(
      document.documentElement,
      el.offsetTop,
      500,
      function(){console.log("animateScroll fired")}
    );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions