I am trying to achieve a scroll effect on a div when the user scrolls down. Below is the HTML code I am working with:
<body>
<div class="container">
<div class="floaty">Yep</div>
content
</div>
The container has a height of around 700px, which may vary depending on the content inside. It has both vertical and horizontal scrolling set in CSS, so that scrolling only affects the content within the div, not the whole page. However, even though the "floaty" element is positioned fixed, it remains at the top of the div and does not move along with the scroll. This might be due to the browser not recognizing the page as scrolling.
In addition, the container has a position relative set. I am wondering how I can resolve this issue and make the div scroll properly. Do I need to use jQuery or is there another solution?