Does anyone know how to stop a pinned item from entering the Header and Footer?

I have tried to add viewport_Enter and Leave code to footer.
Also tried adding a box to footer and viewport_Enter/Leave with that.
Nothing seems to work???
Any ideas will be much appreciated.
TIA.
Martin

Already tried to set the header and footer to —> FIXED in the Header/Footer-options? Could eventually help.