Denis
Denis

Reputation: 11

How to place <div> over floating image?

I need to place zoom icons over site images. Some of images have float=left or float=right style. I can use jQuery, this is an example of my problem: http://jsfiddle.net/4Nvbe/1/

My current code:

$("a[rel^='lightbox']").each(function () { $(this).prepend('<div class="zoom"></div>'); });

Upvotes: 1

Views: 106

Answers (1)

Bas Slagter
Bas Slagter

Reputation: 9929

You need to position the icons absolutely (position: absolute) and then use top, left and/or right properties to position them on the right spot over the image. Use position:relatvie in the wrapping (image) element to prevent the icons to position out of the image scope.

Upvotes: 1

Related Questions