diff --git a/brozzler/js-templates/umbraBehavior.js.j2 b/brozzler/js-templates/umbraBehavior.js.j2 index 50ae065..7931a62 100644 --- a/brozzler/js-templates/umbraBehavior.js.j2 +++ b/brozzler/js-templates/umbraBehavior.js.j2 @@ -80,13 +80,13 @@ class UmbraBehavior { continue; } - for (var i = 0; i < doTargetsLength; i++) { + for ( var i = 0; i < doTargetsLength; i++) { if (!repeatSameElement && this.alreadyDone.indexOf(doTargets[i]) > -1) { continue; } - //if (!this.isVisible(doTargets[i])) { - // continue; - //} + if (!this.isVisible(doTargets[i])) { + continue; + } var where = this.aboveBelowOrOnScreen(doTargets[i]); if (where == 0) { this.doTarget(doTargets[i], action); @@ -101,7 +101,10 @@ class UmbraBehavior { } if (!didSomething) { - if (somethingLeftBelow || ( (window.scrollY + window.innerHeight) < document.documentElement.scrollHeight)) { + if (somethingLeftAbove) { + window.scrollBy(0, -500); + this.idleSince = null; + } else if (somethingLeftBelow || ( (window.scrollY + window.innerHeight) < document.documentElement.scrollHeight)) { window.scrollBy(0, 200); this.idleSince = null; } else if (this.idleSince == null) {