Skip to content

Commit

Permalink
fix: IntersectionObserver 对象方法 relativeTo relativeToViewport 支持链式调用
Browse files Browse the repository at this point in the history
  • Loading branch information
zhetengbiji committed Jul 4, 2019
1 parent e040aec commit 4f93c8f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/service/api/create-intersection-observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ class MPIntersectionObserver {
relativeTo (selector, margins) {
this.options.relativeToSelector = selector
this._makeRootMargin(margins)
return this
}
relativeToViewport (margins) {
this.options.relativeToSelector = null
this._makeRootMargin(margins)
return this
}
observe (selector, callback) {
if (typeof callback !== 'function') {
Expand Down

0 comments on commit 4f93c8f

Please sign in to comment.