Skip to content

Instantly share code, notes, and snippets.

@ghorvat
Last active September 22, 2015 20:23
Show Gist options
  • Save ghorvat/b6df5e39527dbb682cef to your computer and use it in GitHub Desktop.
Save ghorvat/b6df5e39527dbb682cef to your computer and use it in GitHub Desktop.
jQuery(function(){
var h1 = 0;
var h2 = 0;
jQuery(".height1").each(function(){
h1 = jQuery(this).outerHeight();
});
jQuery(".height2").each(function(){
h2 = jQuery(this).outerHeight();
});
console.log(h1 + " " + h2)
var calc = h2/h1*100;
console.log(calc);
if (document.styleSheets[0]){
document.styleSheets[0].addRule('.square-tile::before','padding-top:100%');
document.styleSheets[0].insertRule('.square-tile::before' + '{padding-top:' + calc + '%' + '!important}', 0);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment