Created
August 6, 2013 20:17
-
-
Save quagliato/6168210 to your computer and use it in GitHub Desktop.
Align a div vertically on the screen
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
var div_to_be_aligned = $('#middle'); | |
var new_margin_top = 0; | |
var descontos = 0; | |
new_margin_top = (document.height - descontos - div_to_be_aligned.height()) / 2; | |
new_margin_top = new_margin_top + descontos / 2; | |
div_to_be_aligned.css('margin-top', new_margin_top + 'px'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment