Skip to content

Instantly share code, notes, and snippets.

@bcullen
Created March 8, 2013 20:06
Show Gist options
  • Select an option

  • Save bcullen/5119448 to your computer and use it in GitHub Desktop.

Select an option

Save bcullen/5119448 to your computer and use it in GitHub Desktop.
Quick & dirty hack for an element absolutely positioned with CSS calc() in IE8
// For .element {right: -webkit-calc(50% - 510px); right: calc(50% - 510px);}
$(document).ready(function() {
calcHack();
$(window).resize(calcHack);
function calcHack() {
var windowWidth = $(window).width();
var offset = 510;
var position = (windowWidth /2) - offset;
$('.element').css({
'right': position + 'px'
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment