Footer over sticky item(s) on scroll


Does any one know a workaround for the following use case?

i have a sticky sidebar in mij project. i would like to place the footer on top of the sticky sidebar when the user scrolls through the page.

Thank you!

Maybe an example is needed to make it more clear.