3

I'm trying to figure out how to use angular-scroll from this source on github:

https://github.com/durated/angular-scroll

I'm still very new to AngularJS and I think I'm having trouble reading in between the lines on this example. I've correctly downloaded angular-scroll using bower, have put it in my index.html, and have injected it as a dependency. What I'm unsure about now is how exactly to use it. If I had a JSFiddle for it I could get it quickly. All I want to do is scroll to an element using its id. I'm currently using $anchorScroll and it's working but I want something smoother.

Any help/examples would be greatly appreciated!

1
  • 2
    Could you add a minimal example of how far you have got (and maybe create a jsfiddle) to demonstrate what you have done so far, please. It's difficult to help you without the specific details of your issue. Commented Oct 6, 2014 at 14:59

1 Answer 1

1

Providing you have followed the steps as you described above it is now a case of simply attaching the directive to the element:

<a href="#title" du-smooth-scroll>Scroll to top</a>

By default this will smooth scroll to the element with the corresponding ID:

<h1 id="title">I am the Scroll target</h1>

Source Code: https://github.com/oblador/angular-scroll/blob/master/example/index.html

Demo: http://oblador.github.io/angular-scroll/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.