Skip to content

Instantly share code, notes, and snippets.

@feng-ming
Last active December 21, 2015 00:09
function letNodeCenter(selector) {
var _top = ($(window).height() - $(selector).heigh())/2,
_left = ($(window).height() = $(selector).height())/2,
_scrollTop = $(document).scrollTop(),
_scrollLeft = $(document).scrollLeft();
$(selector).css({position: 'absolute', top: top + scrollTop, left: left + scrollLeft }).show()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment