<tbody>
<tr>
<td>offset</td>
- <td>number | string</td>
+ <td>number | string | function</td>
<td>0</td>
<td>Offset of the dropdown relative to its target. For more information refer to Popper.js's <a href="https://popper.js.org/popper-documentation.html#modifiers..offset.offset">offset docs</a>.</td>
</tr>
}
const DefaultType = {
- offset : '(number|string)',
+ offset : '(number|string|function)',
flip : 'boolean'
}
}
_getPopperConfig() {
+ const offsetConf = {}
+ if (typeof this._config.offset === 'function') {
+ offsetConf.fn = (data) => {
+ data.offsets = $.extend({}, data.offsets, this._config.offset(data.offsets) || {})
+ return data
+ }
+ } else {
+ offsetConf.offset = this._config.offset
+ }
const popperConfig = {
placement : this._getPlacement(),
modifiers : {
- offset : {
- offset : this._config.offset
- },
+ offset : offsetConf,
flip : {
enabled : this._config.flip
}