Skip to content

Commit

Permalink
ensure parent
Browse files Browse the repository at this point in the history
  • Loading branch information
RyoNkmr committed Jun 26, 2018
1 parent 0a9d273 commit 31e6121
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ <h3 id="Options-marginTop" class="option">
<h3 id="Options-wrapper" class="option">
wrapper
<span class="option__type">HTMLElement</span>
<span class="option__default">document.body</span>
<span class="option__default">parentElement|document.body</span>
</h3>
<p>Ipsum laboriosam odio minus sunt officiis. Veniam sed saepe inventore labore ratione adipisci Sed unde sapiente porro accusamus quo Dolorem deserunt veniam ducimus neque velit. Esse saepe deserunt ipsam similique</p>
<p>Ipsum laboriosam odio minus sunt officiis. Veniam sed saepe inventore labore ratione adipisci Sed unde sapiente porro accusamus quo Dolorem deserunt veniam ducimus neque velit. Esse saepe deserunt ipsam similique</p>
Expand Down
5 changes: 3 additions & 2 deletions docs/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/index.js

Large diffs are not rendered by default.

Binary file modified lib/index.js.gz
Binary file not shown.
3 changes: 2 additions & 1 deletion src/sticky.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export default class Sticky {
if (!(document.body instanceof HTMLElement)) {
throw new TypeError('[Stuck.js] document.body is not HTMLElement in this environment');
}
this.$$wrapper = Sticky.normalizeElement(value, this.element.parentElement, document.body);
const parent = ((this.placeholder && this.placeholder.element) || this.element).parentElement;
this.$$wrapper = Sticky.normalizeElement(value, parent, document.body);
this.floor = Sticky.computeAbsoluteFloor(this.$$wrapper);
this.options.wrapper = this.$$wrapper;
}
Expand Down

0 comments on commit 31e6121

Please sign in to comment.