Index: trunk/extensions/VisualEditor/modules/es/views/es.ToolbarView.js |
— | — | @@ -19,32 +19,29 @@ |
20 | 20 |
|
21 | 21 | this.$ = $container;
|
22 | 22 | this.surfaceView = surfaceView;
|
| 23 | + this.$spacer = $('<div>');
|
| 24 | + this.$.after( this.$spacer );
|
23 | 25 |
|
24 | 26 | /*
|
25 | 27 | * This code is responsible for switching toolbar into floating mode when scrolling (with
|
26 | | - * keyboard or mouse). It assumes that original padding-top of next sibiling element is 0
|
27 | | - * (if that will be a problem in future we may introduce spacer element and set it height,
|
28 | | - * since even remembering original padding-top is not a solution because it may be set in em
|
29 | | - * instead of px). |
| 28 | + * keyboard or mouse). |
30 | 29 | */
|
31 | 30 | $window.scroll( function() {
|
32 | 31 | if ( _this.surfaceView.dimensions.scrollTop >= _this.surfaceView.dimensions.toolbarTop ) {
|
33 | 32 | if ( ! _this.$.hasClass( 'float' ) ) {
|
34 | 33 | var left = _this.$.offset().left,
|
35 | 34 | right = $window.width() - _this.$.outerWidth() - left;
|
36 | | -
|
37 | 35 | _this.$.css( 'right', right );
|
38 | 36 | _this.$.css( 'left', left );
|
39 | | -
|
40 | 37 | _this.$.addClass( 'float' );
|
41 | | - _this.$.next().css( 'padding-top', _this.$.height() );
|
| 38 | + _this.$spacer.height( _this.$.height() );
|
42 | 39 | }
|
43 | 40 | } else {
|
44 | 41 | if ( _this.$.hasClass( 'float' ) ) {
|
45 | 42 | _this.$.css( 'right', 0 );
|
46 | 43 | _this.$.css( 'left', 0 );
|
47 | 44 | _this.$.removeClass( 'float' );
|
48 | | - _this.$.next().css( 'padding-top', 0 );
|
| 45 | + _this.$spacer.height(0);
|
49 | 46 | }
|
50 | 47 | }
|
51 | 48 | } );
|