Search

Friends

Atomspheric CO2 (PPM)

Archives

Blather

Uptime verified by Wormly.com

30 August 2011

Postcard to Libby

Postcard to Libby

Posted by Nutloaf

The picture is of when someone (such as a king) says "continue" so that
people who have stopped dancing know they should continue to dance (such as
in The Man in the Iron Mask)

28 August 2011

Baby face

Baby face

Posted by Nutloaf

12 August 2011

Discussion of music industry gets heated

Discussion of music industry gets heated

Posted by Nutloaf

5 August 2011

Vertical centering of cropped image with jQuery

You can use HTML, CSS and jQuery to vertically center cropped images that you don't know the height of. It's a shame to use jQuery at all, but I think it's necessary. I looked at the CSS clip property and at negative proportional margins (margin-top: -50%; etc.), but unless you know the height of the image I don't think it will work.

<div style="height:100px;overflow:hidden;">
    <img id="crop" src="blah.jpg" style="height:200px;" />
</div>

<script type="text/javascript">
jQuery(document).ready(function($) {
    var image = $("#crop");
    image.css('marginTop', (-(image.height() - image.parent().height()) / 2) + "px");
});
</script>

2.239 seconds