return this.options.hOffset;
}
-
_setPosition($anchor, $element, $parent) {
if($anchor.attr('aria-expanded') === 'false'){ return false; }
- var $eleDims = Box.GetDimensions($element),
- $anchorDims = Box.GetDimensions($anchor);
-
if (!this.options.allowOverlap) {
// restore original position & alignment before checking overlap
$element.offset(Box.GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset()));
if(!this.options.allowOverlap) {
- var overlaps = {};
var minOverlap = 100000000;
// default coordinates to how we start, in case we can't figure out better
var minCoordinates = {position: this.position, alignment: this.alignment};
* @param {Boolean} isOverflow - if a collision event is detected, sets to true to default the element to full width - any desired offset.
* TODO alter/rewrite to work with `em` values as well/instead of pixels
*/
-function GetOffsets(element, anchor, position, vOffset, hOffset, isOverflow) {
- console.log("NOTE: GetOffsets is deprecated in favor of GetExplicitOffsets and will be removed in 6.5");
- switch (position) {
- case 'top':
- return Rtl() ?
- GetExplicitOffsets(element, anchor, 'top', 'left', vOffset, hOffset, isOverflow) :
- GetExplicitOffsets(element, anchor, 'top', 'right', vOffset, hOffset, isOverflow);
- case 'bottom':
- return Rtl() ?
- GetExplicitOffsets(element, anchor, 'bottom', 'left', vOffset, hOffset, isOverflow) :
- GetExplicitOffsets(element, anchor, 'bottom', 'right', vOffset, hOffset, isOverflow);
- case 'center top':
- return GetExplicitOffsets(element, anchor, 'top', 'center', vOffset, hOffset, isOverflow);
- case 'center bottom':
- return GetExplicitOffsets(element, anchor, 'bottom', 'center', vOffset, hOffset, isOverflow);
- case 'center left':
- return GetExplicitOffsets(element, anchor, 'left', 'center', vOffset, hOffset, isOverflow);
- case 'center right':
- return GetExplicitOffsets(element, anchor, 'right', 'center', vOffset, hOffset, isOverflow);
- case 'left bottom':
- return GetExplicitOffsets(element, anchor, 'bottom', 'left', vOffset, hOffset, isOverflow);
- case 'right bottom':
- return GetExplicitOffsets(element, anchor, 'bottom', 'right', vOffset, hOffset, isOverflow);
- // Backwards compatibility... this along with the reveal and reveal full
- // classes are the only ones that didn't reference anchor
- case 'center':
- return {
- left: ($eleDims.windowDims.offset.left + ($eleDims.windowDims.width / 2)) - ($eleDims.width / 2) + hOffset,
- top: ($eleDims.windowDims.offset.top + ($eleDims.windowDims.height / 2)) - ($eleDims.height / 2 + vOffset)
- }
- case 'reveal':
- return {
- left: ($eleDims.windowDims.width - $eleDims.width) / 2 + hOffset,
- top: $eleDims.windowDims.offset.top + vOffset
- }
- case 'reveal full':
- return {
- left: $eleDims.windowDims.offset.left,
- top: $eleDims.windowDims.offset.top
- }
- break;
- default:
- return {
- left: (Rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width - hOffset: $anchorDims.offset.left + hOffset),
- top: $anchorDims.offset.top + $anchorDims.height + vOffset
- }
-
- }
-
-}
-
function GetExplicitOffsets(element, anchor, position, alignment, vOffset, hOffset, isOverflow) {
var $eleDims = GetDimensions(element),
$anchorDims = anchor ? GetDimensions(anchor) : null;