I have a div with let say height at 400px. The content is much longer, so the div can scroll (y axis). On the right side of the div, I need some buttons to have a fixed position inside this div.
How can I do it? jQuery, CSS, whatever - I don't mind.
I tried fixTo - but it doesn't seem to work for this - and a CSS solution that says: "Use position: fixed, but not left / right - just margin." It works fine, but if the page itself scrolls, the buttons also scroll - which they shouldn't. They must remain stationary inside the div at all times.
Code example:
<div class="container" style="width: 960px; height: 400px; position: relative;"> <div class="buttons needToBeFixed"></div> <div class="aLotOfContent" style="width: 2000px;"></div> </div>
jquery css
Christian bundgaard
source share