I've been searching for a solution to this issue, but it seems like I might not be articulating it correctly because I haven't been able to find an answer yet.
On my page, there is a 'quick links' button that is supposed to stay fixed on the right side of the screen while scrolling.
To achieve this effect, I have used the following CSS code (the right attribute is used to hide the menu that appears when the element is clicked on):
#quickLinks {
position: fixed;
display: block;
top: 50%;
z-index: 2;
right: -250px;
}
While this setup works well, I am having trouble adjusting for the presence or absence of a scroll bar.
So I added some padding to the right attribute to account for the scroll bar's appearance (which is generally present on my page), but this creates unnecessary space when there is no scroll bar visible on devices like an iPad.
I noticed that using 'absolute' instead of 'fixed' fixes the hugging effect issue, but then the floating scroll functionality is lost.
If anyone has any ideas or suggestions, I would greatly appreciate it. :)
Thank you!