Skip to content

Commit

Permalink
fixing the issue with incorect menu placement
Browse files Browse the repository at this point in the history
  • Loading branch information
tumbochka committed Sep 17, 2015
1 parent 83c640b commit c1b5659
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions lib/FSelectMenu/Bundle/Resources/public/js/modules/fselectmenu.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@

/**
* - init() has to be called only one time for the life of the page;
* newly inserted select menus will automatically be handled without
* having to call init() again.
* - init() is very lightweight, it only set up a few event handlers
* - script can work directly with the native element for most things (e.g.
* getting and changing the value)
*/
define(function() {


(function( root,factory ) {
if ( typeof define === "function" && define.amd ) {

// AMD. Register as an anonymous module.
define([], factory );


} else if (typeof exports === "object") {
// Node/CommonJS:
factory();

} else {

// Browser globals
root.FSelectMenu = factory( );
}
}(this, function() {

var namespace = 'fselectmenu';

Expand Down Expand Up @@ -42,6 +52,7 @@ define(function() {
selectOption: function($elem) {
// .data() tries to convert the value to number
this._input.val($elem.attr('data-value')).change();
$('.fselectmenu-label').html($elem.html());
}
, disabled: function() {
if (this._input.prop('disabled')) {
Expand Down Expand Up @@ -133,8 +144,10 @@ define(function() {

var root = this._root
, offset = root.offset()
, height = root.outerHeight()
, width = root.outerWidth();
, height = root.outerHeight().height()
, width = root.outerWidth().width();



this._options.css({
'minWidth': width+'px'
Expand Down Expand Up @@ -358,4 +371,4 @@ define(function() {
return {
init: init
};
});
}));

0 comments on commit c1b5659

Please sign in to comment.