From: Daniel Ruf Date: Sat, 5 Oct 2019 15:52:10 +0000 (+0200) Subject: fix: prevent error when the value of $anchorDims is null X-Git-Tag: v6.6.2^2~17^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11832%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fix: prevent error when the value of $anchorDims is null --- diff --git a/js/foundation.util.box.js b/js/foundation.util.box.js index 11688c358..360c044a6 100644 --- a/js/foundation.util.box.js +++ b/js/foundation.util.box.js @@ -124,8 +124,8 @@ function GetExplicitOffsets(element, anchor, position, alignment, vOffset, hOffs var topVal, leftVal; + if ($anchorDims !== null) { // set position related attribute - switch (position) { case 'top': topVal = $anchorDims.offset.top - ($eleDims.height + vOffset); @@ -141,7 +141,6 @@ function GetExplicitOffsets(element, anchor, position, alignment, vOffset, hOffs break; } - // set alignment related attribute switch (position) { case 'top': @@ -173,6 +172,8 @@ function GetExplicitOffsets(element, anchor, position, alignment, vOffset, hOffs } break; } + } + return {top: topVal, left: leftVal}; }