kotarok
2/23/2011 - 12:56 PM

Fix the Firefox's bug that vertical margins of table elements don't collapse.

Fix the Firefox's bug that vertical margins of table elements don't collapse.

$.fn.fixFxTableMargin = function(conf){
	if(!$.browser.mozilla) return this;

	this.each(function(){
		var elem = $(this);
		elem.wrap('<div class="fixFxTableMargin" />');
		var mt = elem.css('margin-top'),
			mb = elem.css('margin-bottom');

		elem.css({'margin-top':0,'margin-bottom':0})
		elem.parent().css({'margin-top':mt,'margin-bottom':mb})
	});
	return this;
};