window.innerHeight property is always 0 on SB1

E Euan Torano 2 years 11 months ago
0 0 0

Seeing as web pages on the SB1 don't seem to have scrollbars or any way to scroll naturally (why?), I've written a simple scroller with an up arrow and a down arrow to mimic the scroller found throughout the rest of the system (eg: settings). The problem is, the window.innerHeight property (which I am using to get the viewport height) is always 0 (or possibly NaN - debugging is painful). My code for the scroller is as follows:
 
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };  Ui.Scroller = (function() {   function Scroller(selector) {     this.selector = selector;     this.onUpClick = __bind(this.onUpClick, this);     this.onDownClick = __bind(this.onDownClick, this);     this.windowHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);     $(selector).children("[data-scroll-up]").on("click", this.onUpClick);     $(selector).children("[data-scroll-down]").on("click", this.onDownClick);     return this;   }    Scroller.prototype.onDownClick = function(event) {     event.preventDefault();     window.scrollBy(0, this.windowHeight);     alert("Scrolling down by " + this.windowHeight);   };    Scroller.prototype.onUpClick = function(event) {     event.preventDefault();     window.scrollBy(0, -this.windowHeight);     alert("Scrolling up by " + this.windowHeight);   };    return Scroller;  })(); 
I wonder if there is any reasoning for this or if it's an issue with the way the browser works on the SB1.

CONTACT
Can’t find what you’re looking for?