Skip to content

Parallax offset from top #19

@theedgy

Description

@theedgy

Hi there.
I noticed that you are calculating element height based on offsetTop value which is relative to closes parent. That means when i put your parallax image into some content wrapper in the middle of page height, then this calculations are based on that wrapper and not on window, so it ends up with half of image because of wrong calculations.

PS. As a reference i fixed it by myself for own purposes, but you can review and use it as well. It was about to change the line : https://github.com/marrio-h/universal-parallax/blob/master/dist/universal-parallax.js#L48
into var containerTop = document.documentElement.scrollTop + container.top

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions