vendor/assets/js/foundation.dropdown.js.es6 in foundation-rails-6.2.0.1 vs vendor/assets/js/foundation.dropdown.js.es6 in foundation-rails-6.2.1.0

- old
+ new

@@ -67,12 +67,15 @@ * Helper function to determine current orientation of dropdown pane. * @function * @returns {String} position - string value of a position class. */ getPositionClass() { - var position = this.$element[0].className.match(/\b(top|left|right)\b/g); - position = position ? position[0] : ''; + var verticalPosition = this.$element[0].className.match(/(top|left|right|bottom)/g); + verticalPosition = verticalPosition ? verticalPosition[0] : ''; + var horizontalPosition = /float-(.+)\s/.exec(this.$anchor[0].className); + horizontalPosition = horizontalPosition ? horizontalPosition[1] : ''; + var position = horizontalPosition ? horizontalPosition + ' ' + verticalPosition : verticalPosition; return position; } /** * Adjusts the dropdown panes orientation by adding/removing positioning classes. @@ -128,10 +131,12 @@ _this = this, direction = (position === 'left' ? 'left' : ((position === 'right') ? 'left' : 'top')), param = (direction === 'top') ? 'height' : 'width', offset = (param === 'height') ? this.options.vOffset : this.options.hOffset; + + if(($eleDims.width >= $eleDims.windowDims.width) || (!this.counter && !Foundation.Box.ImNotTouchingYou(this.$element))){ this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({ 'width': $eleDims.windowDims.width - (this.options.hOffset * 2), 'height': 'auto' }); @@ -139,10 +144,10 @@ return false; } this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, position, this.options.vOffset, this.options.hOffset)); - while(!Foundation.Box.ImNotTouchingYou(this.$element) && this.counter){ + while(!Foundation.Box.ImNotTouchingYou(this.$element, false, true) && this.counter){ this._reposition(position); this._setPosition(); } }