Created
February 23, 2011 12:56
-
-
Save kotarok/840389 to your computer and use it in GitHub Desktop.
Fix the Firefox's bug that vertical margins of table elements don't collapse.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use like this:
$('table').fixFxTableMargin();