X-, y-positions of the right viewport, bottom edges (respectively)?

I am looking for a way without plugins to get the x-coordinate of the visible right edge of the visible window, as well as the y-coordinate of its bottom edge, using either jQuery or "plain" JavaScript.

Thanks!

+4
source share
3 answers

I finally decided to use this solution (jQuery):

var $w = $(window); var right_edge_x = $w.scrollLeft() + $w.width(); var bottom_edge_y = $w.scrollTop() + $w.height(); 

I'm not sure exactly how it differs from the other solutions proposed, not to mention whether it is better, but at least I can understand it ...

+3
source
 var width = document.documentElement.clientWidth || window.innerWidth; var height= document.documentElement.clientHeight|| window.innerHeight; 
+6
source

I think you can use a window object. That would be something like

 winX = Window.screenX + Window.outerWidth; winY = Window.screenY + Window.outerHeight; 

In any case, I think you understand. The good news is that it's pure JS vanilla.

Full documents can be found here:

http://www.w3schools.com/jsref/obj_window.asp

0
source

All Articles