Created
August 20, 2012 15:30
-
-
Save schjetne/3405181 to your computer and use it in GitHub Desktop.
Prevent images from disrupting vertical flow
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
// Prevent images from disrupting vertical flow | |
$(window).resize(function() { | |
var fontSize = parseInt($('body').css('font-size'),0);; | |
var lineHeight = parseInt($('body').css('line-height'),0);; | |
$('.baseline').each(function() { | |
var heightDif = $(this).outerHeight(); | |
$(this).css('margin-bottom', fontSize + heightDif % lineHeight); | |
}); | |
}); | |
$('.baseline').load(function() { $(window).resize(); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment