valign Revision 626437386535 (Mon May 31 2010 at 04:58) - Diff Link to this snippet: https://friendpaste.com/12G0NEe1Aiy7RDZZu2VGle Embed: manni perldoc borland colorful default murphy trac fruity autumn bw emacs pastie friendly Show line numbers Wrap lines 123456789101112131415161718jQuery.fn.valign = function() { $(this) .wrapInner('<div class="valign-box"></div>') .css("position", "relative"); xH = $(this).children('.valign-box').height(); $(this).children('.valign-box') .css({ "position" : "absolute", "height" : xH, "top" : "50%", "margin-top" : 0-(xH/2) }); }; $(document).ready(function() { $("#viewer ul li").valign(); });