angular-scroll icon indicating copy to clipboard operation
angular-scroll copied to clipboard

duScrollspy not working and other strange behaviour

Open ux-engineer opened this issue 9 years ago • 7 comments

Hi,

When I added this to my navigation controller to be run before view change:

$document.scrollTop(top, duration).then(function() {
  console && console.log('You just scrolled to the top!');
});

I get console errors:

Error: $document.scrollTop(...).then is not a function
$scope.selectView@https://myapp.loc/pkg/myapp/js/controllers.js:604:3
$parseFunctionCall@https://myapp.loc/pkg/angular/js/angular13.js:12133:15
ngEventHandler/</callback@https://myapp.loc/pkg/angular/js/angular13.js:22518:17
$RootScopeProvider/this.$get</Scope.prototype.$eval@https://myapp.loc/pkg/angular/js/angular13.js:14123:16
$RootScopeProvider/this.$get</Scope.prototype.$apply@https://myapp.loc/pkg/angular/js/angular13.js:14221:18
ngEventHandler/<@https://myapp.loc/pkg/angular/js/angular13.js:22523:17
x.event.dispatch@https://myapp.loc/pkg/jquery/js/jquery.js:5:9453
x.event.add/y.handle@https://myapp.loc/pkg/jquery/js/jquery.js:5:6271

For some reason "du-scrollspy" is not working at all, no errors in console. I have tried in on several different elements, only one at a time and no other directives or functionalities of this library in use. I encountered the above mentioned error when trying other functionality to ensure the library has been properly loaded as it was failing silently.

ux-engineer avatar Jul 03 '15 06:07 ux-engineer

Aha, changing scrollTop to duScrollTo solved the first issue as mentioned in the doc. But the main problem is open that why du-scrollspy is not doing anything.

ux-engineer avatar Jul 03 '15 06:07 ux-engineer

Does the demo work? If so, then you're doing something wrong but it's hard for me to tell what without any code. Can you post a plunker?

On Fri, Jul 3, 2015 at 8:29 AM, Janne Kurkinen [email protected] wrote:

Aha, chinging scrollTop to duScrollTo solved the first issue as mentioned in the doc. But the main problem is open that why du-scrollspy is not doing anything.

Reply to this email directly or view it on GitHub: https://github.com/oblador/angular-scroll/issues/130#issuecomment-118250061

oblador avatar Jul 03 '15 06:07 oblador

I would need scrollspy feature for just so simple task that a sub-navigation element would be applied a class / fixed position after it is scrolled over the top. Perhaps this library is overkill for it?

I just tried to strip the demo off all the scrollspy features except one element having du-scrollspy directive applied. No active class was applied then.

ux-engineer avatar Jul 04 '15 16:07 ux-engineer

du-scrollspy relies on the href attribute to find it's target so if you remove that you need to define it like this instead: du-scrollspy="anchor"

oblador avatar Oct 01 '15 22:10 oblador

I found a weird hidden issue in my code that my be relevant to you, mentioned here.

homerjam avatar Dec 03 '15 16:12 homerjam

@envision @homerjam what AngularJS version do you have? I have the same issue with Angular 1.5.5

michelem09 avatar Apr 27 '16 18:04 michelem09

Sorry can't recall what I was using then but certainly pre 1.5.5. Checkout my comment in the other thread - it was down to the component/view/controller being compiled twice for some reason.

homerjam avatar Apr 27 '16 18:04 homerjam