From 66f3c08da486fc12b94b138a3dea0fa67adc9b21 Mon Sep 17 00:00:00 2001 From: Alexander Fontenot Date: Tue, 20 Feb 2018 15:19:14 -0500 Subject: [PATCH] correct scrollspy to account for offset --- angular-scroll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-scroll.js b/angular-scroll.js index b59fdfb..ead8ce9 100644 --- a/angular-scroll.js +++ b/angular-scroll.js @@ -288,7 +288,7 @@ angular.module('duScroll.spyAPI', ['duScroll.scrollContainerAPI']) pos = spy.getTargetPosition(); if (!pos || !spy.$element) continue; - if((duScrollBottomSpy && bottomReached) || (pos.top + spy.offset - containerOffset < 20 && (duScrollGreedy || pos.top*-1 + containerOffset) < pos.height)) { + if((duScrollBottomSpy && bottomReached) || (((pos.top + spy.offset - containerOffset) < 20) && (duScrollGreedy || (((pos.top*-1) + (containerOffset - spy.offset)) < pos.height)))) { //Find the one closest the viewport top or the page bottom if it's reached if(!toBeActive || toBeActive[compareProperty] < pos[compareProperty]) { toBeActive = {