I need to position a div over an image with jQuery. I can create it with using position: fixed and use top and left to position it using elements offset, but it sucks because the element will not be on top of the element if user scrolls.
Any other ideas?
If you’re doing this multiple places, you can do this:
If you match the
height/widthstyle attributes on the inner/ouer divs, the inner<div>comes before the<img />and you give the inner<div>a higher z-index than the image, it’ll perfectly overlap the image.You can see an example of this in action here: http://jsfiddle.net/ZcBus/