dojo/dom-geometry::docScroll()

Project owner:Eugene Lazutkin
since:V1.7

Returns a normalized object with {x, y} with corresponding offsets for the scroll position for the current document.

Usage

require(["dojo/dom-geometry"], function(domGeom){
  var output = domGeom.docScroll();
});

Attributes

This function requires no arguments, and references the current document.

Examples

require(["dojo/dom-geometry", "dojo/dom", "dojo/on", "dojo/json", "dojo/domReady!"],
function(domGeom, dom, on, JSON){
  on(dom.byId("command"), "click", function(){
    var output = domGeom.docScroll();
    dom.byId("output").innerHTML = JSON.stringify(output);
  });
});
<div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div>
<button id="command" type="button">Execute docScroll()</button>
<pre id="output"></pre>
<div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div>
<div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div>
<div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div>
Error in the documentation? Can’t find what you are looking for? Let us know!