Position toolbar if loading with non-zero scroll offset

The scroll event doesn't fire if the page is already scrolled
when ve is loaded.

Change-Id: I5b5a2dff2055d9ff1a8b2a2e0016a3fe7aaf22fb
This commit is contained in:
Ed Sanders 2013-06-26 13:16:20 +01:00
parent 10948ba91f
commit bc04b08892

View file

@ -245,6 +245,11 @@ ve.ui.Toolbar.prototype.resetPosition = function () {
*/
ve.ui.Toolbar.prototype.enableFloating = function () {
this.$window = $( this.getElementWindow() ).on( this.windowEvents );
// TODO: Place this is a DOM attach event for this.$
setTimeout( ve.bind( function () {
// The page may load with a non-zero scroll without trigger the scroll event
this.onWindowScroll();
}, this ), 0 );
};
/**