If I have a fixed sized container div, and an unknown sized image, how do I horizontally and vertically center it?
I used
.on('load', function () {
instead
.each(function(){
used in this answer it helps to eliminate the problem with empty values of height and width when the picture is not yet loaded