Last active
December 25, 2015 04:09
-
-
Save bazzooka/6915070 to your computer and use it in GitHub Desktop.
Replace each images of the document with colored block.
Each block contain it's size.
Usefull to work without images but with blocks sizes
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
function revealSizes() { | |
$('img').each(function() { | |
var w = $(this).width(), h = $(this).height(), c = (Math.random() * 0xFFFFFF << 0).toString(16), classes = $(this).attr('class'); | |
var div = $('<div />').css({ | |
background: '#'+c, | |
fontSize: '200%' | |
}).width(w).height(h).addClass(classes).html(w+'x'+h); | |
$(this).replaceWith(div); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment