Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use scrollTop of parent_selector instead of window? #257

Open
nowherenearithaca opened this issue Feb 26, 2018 · 2 comments
Open

Use scrollTop of parent_selector instead of window? #257

nowherenearithaca opened this issue Feb 26, 2018 · 2 comments

Comments

@nowherenearithaca
Copy link

Hi

The current implementation seems to assume you care about scrolltop of the window, and I want it to be within the parent.

I changed the calcs to use the scrollTop of the (specified) parent and it seemed to work, but was wondering if there a way to do this without messing the code.

thanks!

@papa-zulu
Copy link

Hi,

Do you mind sharing your modified code?

@keith0305
Copy link

keith0305 commented Feb 20, 2020

Yes I find myself needing this functionality too.
Currently my workaround is something like:

$('.sticky').stick_in_parent({
    offset_top: $('.sticky').parent().get(0).getBoundingClientRect().top,
});
$('.sticky').parent().scroll(function () {
    $(document.body).trigger('sticky_kit:recalc');
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants