I am currently working on a web application using angularjs, and I have multiple nested div
elements that correspond to selectable items. One of my main challenges is ensuring that when a user clicks on a div
element, it scrolls into view correctly on the page. You can see an example of this in the official AngularJS documentation:
http://plnkr.co/edit/qncMfyJpuP2r0VUz0ax8?p=preview
Currently, each div
has a ng-click="gotoAnchor(x)"
event attached to it. However, due to a header on the page, the first div
with the anchor and click event is not always at the top of the screen. This results in the header blocking the view if scrolled to. Is there a way to activate the anchor only when the div
is partially hidden off-screen? Alternatively, if you have any other suggestions for achieving this functionality without anchors, I would appreciate your input.
Thank you for your help.