遵循 jQuery github 上的指南后,如果我想升级,我消除了 8/10 问题。但是我有 2 个问题,我无法自己解决或在谷歌的帮助下解决。请看一看:
JQMIGRATE:jQuery.fn.offset() 需要有效的 DOM 元素
var viewportOffsets = this.$viewportElement.offset(),
hasOffsets = viewportOffsets !== null && viewportOffsets !== undefined;
this.viewportWidth = this.$viewportElement.width();
this.viewportHeight = this.$viewportElement.height();
this.viewportOffsetTop = (hasOffsets ? viewportOffsets.top : 0);
this.viewportOffsetLeft = (hasOffsets ? viewportOffsets.left : 0);
},
以下是 JQMIGRATE: jQuery.fn.offset() 需要一个连接到文档的元素
$backgroundElements.each(function() {
var $this = $(this),
backgroundPosition = getBackgroundPosition($this),
horizontalOffset,
verticalOffset,
positionLeft,
positionTop,
marginLeft,
marginTop,
offsetLeft,
offsetTop,
$offsetParent,
parentOffsetLeft = 0,
parentOffsetTop = 0,
tempParentOffsetLeft = 0,
tempParentOffsetTop = 0;
// Ensure this element isn't already part of another scrolling element
if (!$this.data('stellar-backgroundIsActive')) {
$this.data('stellar-backgroundIsActive', this);
} else if ($this.data('stellar-backgroundIsActive') !== this) {
return;
}
我该如何解决这个问题?