问题描述:

I decided to use the Single Page Application model - with a seperate controllers.js, services.js and app.js in order to create a website, which would actually stack the views on top of one another, not update the view on view change.

I was basically trying to use the ui-view directive, because I wanted to put the knowledge in a basic example.

The problem I am stumbling upon is the following: I have a header.html, in which an anchor <a></a> link is pointing to a div in another .html file. I couldn't get the scroll to work, but somebody on stackoverflow had shown a workaround with $location.hash(''); and $anchorScroll.

In my case this has 2 downsides:

  1. I'd like to have a smooth, animated scroll from the anchor to the div. I read around and found out this can't be done with the $anchorScroll. I was wondering - can ScrollMagic be implemented in such a way that it provides scrolling capabilities.
  2. Using the $anchorScroll method, when scrolling back to the top of the page, and clicking the same anchor, it doesn't work.


It's my first post on SO, so any help on how to present you the code in an ordered manner is welcome.

相关阅读:
Top