sticky-kit
sticky-kit copied to clipboard
Use scrollTop of parent_selector instead of window?
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!
Hi,
Do you mind sharing your modified code?
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');
});