PDA

View Full Version : display a blank with a scroll, very strange



perry_jia
8 Jun 2011, 2:14 AM
Hi,
I realized that the sencha-touch examples, if you click any one(test in Google Chrome), there will display a blank with a scroll before the page load complete,
I fell it is very strange, look at the following pic.
26494

So I look up the source code and i found :


Ext.Viewport = new (Ext.extend(Ext.util.Observable, {
init : function(c, b) {
var d = this, e = Math.max(window.innerHeight, window.innerWidth) * 2, a = Ext.getBody();
d.updateOrientation();
this.initialHeight = window.innerHeight;
this.initialOrientation = this.orientation;
a.setHeight(e);
Ext.gesture.Manager.freeze();
this.scrollToTop();
setTimeout(function() {
d.scrollToTop();
setTimeout(function() {
d.scrollToTop();
d.initialHeight = Math.max(d.initialHeight, window.innerHeight);
if (c) {
c.apply(b || window)
}
d.updateBodySize();
Ext.gesture.Manager.thaw()
}, 500)
}, 500)
}
}))


if i remove the red code above, there will be no blank and scroll, looks very smooth.
I don't know why sencha developer do that.