Fixed an issue where not all the results of the intersection observer were being checked.

This commit is contained in:
MattMo 2024-09-02 16:19:40 -07:00
parent 939d1ec83a
commit 812f8352f5

View File

@ -1511,10 +1511,15 @@ class IgniteTemplate {
//Setup a intersect observer if needed //Setup a intersect observer if needed
if (this._intersectObserverCallback && this._intersectObserverCallback.length > 0) { if (this._intersectObserverCallback && this._intersectObserverCallback.length > 0) {
this._intersectObserver = new IntersectionObserver(results => { this._intersectObserver = new IntersectionObserver(results => {
if (results[0].isIntersecting) { if (results) {
for (var i = 0; i < this._intersectObserverCallback.length; i++) { for (var i = 0; i < results.length; i++) {
if (this._intersectObserverCallback[i]) { if (results[i].isIntersecting && results[i].target == this.element) {
this._intersectObserverCallback[i](results[0]); for (var i2 = 0; i2 < this._intersectObserverCallback.length; i2++) {
if (this._intersectObserverCallback[i2]) {
this._intersectObserverCallback[i2](results[i]);
}
}
break;
} }
} }
} }