You can see it in action here: http://www.redkitecreative.com/projects/naww/
1. Get the latest copy of jquery; I saved mine into the /lib folder.
2. In your template header, place the following:
Code: Select all
<__script__ type="text/javascript" src="lib/jquery-1.2.6.js"></__script>Code: Select all
<__script__ type="text/javascript">
$(document).ready(function(){
$('img.captioned').each(
function() {
var caption = $(this).attr('title');
$(this)
.wrap('<div class="imgcontainer"></div>')
.after('<div class="caption">'+caption+'</div>');
}
);
});
</__script>Code: Select all
.imgcontainer {
position: relative;
float: right;
margin:0.5em 0 1em 1em;
}
.caption {
position: absolute;
padding: 0.1em 0.2em;
bottom: 0;
left: 0;
font-size: 0.9em;
text-align: center;
color: #000;
background: #fff;
width: 100%;
opacity: .75;
filter: alpha(opacity=85);
}
.imgcontainer img {
display: block;
}What you should get is an image with a semi-transparent bar at the bottom and the title text you entered displayed as the caption. This works fine in FF, Safari (for Windows at least), IE7, IE6, and Opera.

