I am new to using JavaScript. How do I determine the float property (left / right) of an image? I think it would be something like this -
var positionFloat = $(this).position();
I am using the following Caption Overlay code from http://davemcmillan.net. Great overlay, I just need to be able to float the caption span with the image - left or right.
Thanks!
// display image caption on top of image
$("#content img").each(function() {
var imageCaption = $(this).attr("alt");
if (imageCaption != '') {
var imgWidth = $(this).width();
var imgHeight = $(this).height();
var position = $(this).position();
var positionTop = (position.top + imgHeight - 26)
$("<span class='img-caption'><em>"+imageCaption+"</em></span>")
.css({"position":"absolute", "top":positionTop+"px", "left":"0", "width":imgWidth +"px"})
.insertAfter(this);
}
});