From 5661c3a714556da376788909ac254b8218e43737 Mon Sep 17 00:00:00 2001 From: Robdel12 Date: Mon, 4 May 2015 10:27:22 -0500 Subject: [PATCH] Fixes #289 --- lib/dropkick.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dropkick.js b/lib/dropkick.js index 83f09194..7844a761 100644 --- a/lib/dropkick.js +++ b/lib/dropkick.js @@ -189,7 +189,7 @@ var position: function( elem, relative ) { var pos = { top: 0, left: 0 }; - while ( elem !== relative ) { + while ( elem && elem !== relative ) { pos.top += elem.offsetTop; pos.left += elem.offsetLeft; elem = elem.parentNode;