Position the language settings
* Expose two options: left and top * Make the init script pass that. * Introduce position method in jquery.uls Change-Id: I21f4d956f1ed2c56528731ab09ecc6a89834f796
This commit is contained in:
committed by
Amir E. Aharoni
parent
841bdfcfe5
commit
398f9ef949
@@ -50,15 +50,24 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the ULS window
|
* Calculate the position of ULS
|
||||||
|
* Returns an object with top and left properties.
|
||||||
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
show: function() {
|
position: function() {
|
||||||
var pos = $.extend( {}, this.$element.offset(), {
|
var pos = $.extend( {}, this.$element.offset(), {
|
||||||
height: this.$element[0].offsetHeight
|
height: this.$element[0].offsetHeight
|
||||||
} );
|
} );
|
||||||
this.$menu.css( {
|
return {
|
||||||
top: pos.top + pos.height,
|
top: pos.top + pos.height,
|
||||||
left: '25%'
|
left: '25%'
|
||||||
|
};
|
||||||
|
},
|
||||||
|
show: function() {
|
||||||
|
var pos = this.position();
|
||||||
|
this.$menu.css( {
|
||||||
|
top: pos.top,
|
||||||
|
left: '25%'
|
||||||
} );
|
} );
|
||||||
|
|
||||||
if ( !this.initialized ) {
|
if ( !this.initialized ) {
|
||||||
|
|||||||
@@ -59,7 +59,11 @@
|
|||||||
var $displaySettings = displaySettings();
|
var $displaySettings = displaySettings();
|
||||||
var that = this;
|
var that = this;
|
||||||
this.$menu.find( "div#settings-block" ).append( $displaySettings );
|
this.$menu.find( "div#settings-block" ).append( $displaySettings );
|
||||||
$displaySettings.languagesettings();
|
var position = this.position();
|
||||||
|
$displaySettings.languagesettings( {
|
||||||
|
top: position.top,
|
||||||
|
left: position.left
|
||||||
|
} );
|
||||||
$displaySettings.on( 'click', function() {
|
$displaySettings.on( 'click', function() {
|
||||||
that.hide();
|
that.hide();
|
||||||
} );
|
} );
|
||||||
|
|||||||
@@ -117,11 +117,13 @@
|
|||||||
var pos = $.extend( {}, this.$element.offset(), {
|
var pos = $.extend( {}, this.$element.offset(), {
|
||||||
height: this.$element[0].offsetHeight
|
height: this.$element[0].offsetHeight
|
||||||
} );
|
} );
|
||||||
|
var top = this.options.top || pos.top + pos.height;
|
||||||
|
var left = this.options.left || '25%';
|
||||||
// FIXME this is not exactly correct. position may not
|
// FIXME this is not exactly correct. position may not
|
||||||
// be relative to the trigger.
|
// be relative to the trigger.
|
||||||
this.$window.css( {
|
this.$window.css( {
|
||||||
top: pos.top + pos.height,
|
top: top,
|
||||||
left: '25%'
|
left: left
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +167,9 @@
|
|||||||
settings: {},
|
settings: {},
|
||||||
template: windowTemplate,
|
template: windowTemplate,
|
||||||
modules: {},
|
modules: {},
|
||||||
defaultModule: false
|
defaultModule: false,
|
||||||
|
top: null,
|
||||||
|
left: null
|
||||||
};
|
};
|
||||||
|
|
||||||
$.fn.languagesettings.Constructor = LanguageSettings;
|
$.fn.languagesettings.Constructor = LanguageSettings;
|
||||||
|
|||||||
Reference in New Issue
Block a user