Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duScrollspy not working and other strange behaviour #130

Open
ux-engineer opened this issue Jul 3, 2015 · 7 comments
Open

duScrollspy not working and other strange behaviour #130

ux-engineer opened this issue Jul 3, 2015 · 7 comments

Comments

@ux-engineer
Copy link

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
Copy link
Author

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.

@oblador
Copy link
Owner

oblador commented Jul 3, 2015

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 notifications@github.com
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:
#130 (comment)

@ux-engineer
Copy link
Author

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.

@oblador
Copy link
Owner

oblador commented Oct 1, 2015

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"

@homerjam
Copy link
Contributor

homerjam commented Dec 3, 2015

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

@michelem09
Copy link

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

@homerjam
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants