# SelectorQuery NodesRef.scrollOffset(function callback)

with Promise style call: Not supported

Mini Program plugin: Support

Adds a scrolling position query request for the node. In pixels. Nodes must be scroll-view or viewportTo return NodesRef Corresponding SelectorQuery

# parameter

# function callback

Callback function, before executing SelectorQuery.exec Method, the node information is displayed in the callback Returns in.

# parameter

# Object res
attribute type Introductions
id string Node ID
dataset Object Node dataset
scrollLeft number Horizontal scrolling position of node
scrollTop number Vertical scroll position of node

# Return value

# SelectorQuery

# sample code

Page({
  getScrollOffset () {
    wx.createSelectorQuery().selectViewport().scrollOffset(function(res){
      res.id      // Node ID
      res.dataset // DataSet for Node
      res.scrollLeft // Horizontal scrolling position of node
      res.scrollTop  // Vertical scroll position of node
    }).exec()
  }
})