Fixed upon scrolling and "no-jump"

Hello,

Upon scrolling, an element will become fixed (scripting solution). My understanding is that once fixed, the element is removed from the normal flow of the page (as absolute would do).

It means it’s height is no longer taken in the regards to other elements.

So, when the element becomes fixed, I have added a margin at the top of the document equal to the height of the fixed element (there is no “jump” effect).

Question: is it possible to have the margin added and yet not seeing it? Like a camouflage.

I’ve played around with this without great success:


margin-top: -100px;
height: 100px;

Is my question clear enough? Is there a way to work around this issue?

Regards,

-jj. :slight_smile:

If you start with the fixed element using position:fixed then you can also start with the margin added.

Hi Stephen, tanks for your reply.

I’m using a scripting solution to fix the element upon scrolling. So I don’t start with the fixed element.

I think we’d need to see an example bit sounds like something the script would/should take care of anyway.