How to find the center point on the page with JavaScript?
How can I find the (x,y) point of the center of the viewable area of the browser?
I am using jQuery, if there are any good jQuery helper functions for th开发者_运维知识库is.
Like this:
var x = $(window).width() / 2;
var y = $(window).height() / 2;
If you want the center point of the whole document (not just the viewable area), you can use $(document)
instead.
精彩评论