Skip to content

Instantly share code, notes, and snippets.

@feng-ming
Last active December 21, 2015 00:09
Show Gist options
  • Save feng-ming/6218118 to your computer and use it in GitHub Desktop.
Save feng-ming/6218118 to your computer and use it in GitHub Desktop.
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