I am creating a voting system. When the user clicks on the link with the class "vote", the voting field appears only on the link with a click. At the moment, it looks like this:

My problem is that if the page scrolls, then the voting field is not located correctly. I want it to always appear just below the link and stick to the link even when scrolling through the page.
My container looks like this:
#vote_container { position: fixed; height: 82px; min-height: 83px; background-color: #e7edf3; border: 3px solid #d3d6d8; border-radius: 10px; left: 40%; margin-top: 6px; padding: 10px; text-align: left; top: 60%; z-index: 199; }
And this is the code that I use to place the container:
var pos = $(this).offset(); var width = $(this).width(); $("#vote_container").css({ "left": (pos.left - 16) + "px", "top": (pos.top + 28) + "px" });
Ive even created a simplified example in jsFiddle.
source share