Increase breakpoints for different number of columns
https://phabricator.wikimedia.org/T138235#2560677 Also, update the default position to be centered on the page. The original 25% was pretty close to this for the wide option, but now that shorter lists are more common, it is no longer sufficient and replaced with a better code.
This commit is contained in:
@@ -134,15 +134,25 @@
|
|||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
position: function () {
|
position: function () {
|
||||||
var pos;
|
var pos,
|
||||||
|
top = this.top,
|
||||||
|
left = this.left;
|
||||||
|
|
||||||
|
if ( top === undefined ) {
|
||||||
|
pos = $.extend( {}, this.$element.offset(), {
|
||||||
|
height: this.$element[ 0 ].offsetHeight
|
||||||
|
} );
|
||||||
|
top = pos.top + pos.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( left === undefined ) {
|
||||||
|
left = $( window ).width() / 2 - this.$menu.outerWidth() / 2;
|
||||||
|
}
|
||||||
|
|
||||||
pos = $.extend( {}, this.$element.offset(), {
|
|
||||||
height: this.$element[ 0 ].offsetHeight
|
|
||||||
} );
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
top: this.top !== undefined ? this.top : pos.top + pos.height,
|
top: top,
|
||||||
left: this.left !== undefined ? this.left : '25%'
|
left: left
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -157,7 +167,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.$menu.addClass( widthClasses[this.getMenuWidth()] );
|
this.$menu.addClass( widthClasses[this.getMenuWidth()] );
|
||||||
this.$menu.css( this.position() );
|
|
||||||
|
|
||||||
if ( !this.initialized ) {
|
if ( !this.initialized ) {
|
||||||
$( 'body' ).prepend( this.$menu );
|
$( 'body' ).prepend( this.$menu );
|
||||||
@@ -165,6 +174,7 @@
|
|||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$menu.css( this.position() );
|
||||||
this.$menu.show();
|
this.$menu.show();
|
||||||
this.$menu.scrollIntoView();
|
this.$menu.scrollIntoView();
|
||||||
this.shown = true;
|
this.shown = true;
|
||||||
@@ -348,11 +358,11 @@
|
|||||||
|
|
||||||
languagesCount = objectLength( this.options.languages );
|
languagesCount = objectLength( this.options.languages );
|
||||||
|
|
||||||
if ( languagesCount < 12 ) {
|
if ( languagesCount < 25 ) {
|
||||||
return 'narrow';
|
return 'narrow';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( languagesCount < 100 ) {
|
if ( languagesCount < 400 ) {
|
||||||
return 'medium';
|
return 'medium';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user