Return to Snippet

Revision: 33831
at October 14, 2010 01:33 by virgil


Initial Code
(function ($) {
	// VERTICALLY ALIGN FUNCTION
	$.fn.vAlign = function() {
		return this.each(function(i){
		var ah = $(this).height();
		var ph = $(this).parent().height();
		var mh = (ph - ah) / 2;
		$(this).css('margin-top', mh);
		});
	};
})(jQuery);

Initial URL

                                

Initial Description
usage: $('div img').vAlign();

Initial Title
Vertically align

Initial Tags

                                

Initial Language
jQuery