Basically my former solution merged into the current state of development.
<div class="dropdown-pane right" id="example-dropdown4" data-dropdown>
Just some junk that needs to be said. Or not. Your choice.
</div>
+
+
+Adding `.float-right` or `.float-left` to the anchor will change the direction of the dropdown as well.
+<button class="button float-right" type="button" data-toggle="example-dropdown5">Bottom-right Aligned</button>
+<div class="dropdown-pane bottom" id="example-dropdown5" data-dropdown>
+ Just some junk that needs to be said. Or not. Your choice.
+</div>
+
+<button class="button float-left" type="button" data-toggle="example-dropdown6">Bottom-left Aligned</button>
+<div class="dropdown-pane bottom" id="example-dropdown6" data-dropdown>
+ Just some junk that needs to be said. Or not. Your choice.
+</div>
\ No newline at end of file
* @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;
}
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),
top: $eleDims.windowDims.offset.top
}
break;
+ case 'left bottom':
+ return {
+ left: $anchorDims.offset.left - ($eleDims.width + hOffset),
+ top: $anchorDims.offset.top + $anchorDims.height
+ };
+ break;
+ case 'right bottom':
+ return {
+ left: $anchorDims.offset.left + $anchorDims.width + hOffset - $eleDims.width,
+ top: $anchorDims.offset.top + $anchorDims.height
+ };
+ break;
default:
return {
left: (Foundation.rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left),