0

I added callback function that is calling when page is scrolling

function scroll (event) {
    this.pageXOffset
} 

When I try to gen this.pageXOffset always return 0.

How can I get current scroll position or current page rect ...?

Misha
  • 433
  • 4
  • 10
  • That is horizontal scroll. Are you sure you aren't after vertical scrolling (`.scrollY`/`.pageYOffset`)? – nmaier Jun 18 '14 at 15:42
  • Thanks for reply. My problem is that all pageYOffset, scrollY and others returns always 0. How can I get some scrolling data. – Misha Jun 19 '14 at 07:59

1 Answers1

0

The event parameter in

Function scroll (event) 

Is [object XrayWrapper [object UIEvent]]

So we can retrieve current window object using next line:

let wnd = XPCNativeWrapper.unwrap(event.currentTarget.content);

Then we can simply use wnd.pageXOffset And it returns correct value.

Misha
  • 433
  • 4
  • 10