The trouble is, I have spacing above it which has a sticky nav bar. I;ve tried adding padding to the top of the element it scrolls to, but when the user scrolls back up, there is space where the element has been offset.
Is there a way I can specify the offset on the page rather than the element in the jQuery for various breakpoints?
Do you have an example you can show us? I think I get what you are saying, but seeing it in action would be better in providing you some options. Thanks.
Unless you have very specifically crafted your page, you do not know the offset of the element prior to execution of the command. That’s why the jQuery function dynamically calls for the element’s offset.
You can modify where it puts the client by adding to the number retrieved by the jQuery function, but it would strongly advise against hardwiring flat numbers into it.