Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My Anchor link won't start at top of page

Tags:

html

angularjs

I am unsure what is going. I have two footers. One footer is a sidebar, and my other footer is a regular footer on the bottom of the page. My anchor tag in my bottom footer, that links to my about page, takes me to the bottom of the page instead of starting at the top, and my anchor tag in my sidebar footer takes me to the middle of the page! Other Anchor Links are taking me also to the middle or random parts of the pages when loaded.

I am not using anything special with the anchor. I don't think...

Here is my anchor for both footers:

<a href="/about" class="a-color">
    <small>About</small>
</a>

My pages are loaded with ng-view. I am not using $anchorScroll

like image 534
Austin Perez Avatar asked Nov 09 '22 06:11

Austin Perez


1 Answers

ngView retains the scroll position when you navigate from one page to another. once view loaded then can use $anchorScroll to change viewport or can add autoscroll="true" to ng-view element

<div class="ng-view" autoscroll="true"></div>
like image 130
Vidyadhar Avatar answered Nov 15 '22 05:11

Vidyadhar