function scroll() {
      var hash = $location.hash(), elm;

      // empty hash, scroll to the top of the page
      if (!hash) $window.scrollTo(0, 0);

      // element with given id
      else if ((elm = document.getElementById(hash))) elm.scrollIntoView();

      // first anchor with given name :-D
      else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView();

      // no element and hash == 'top', scroll to the top of the page
      else if (hash === 'top') $window.scrollTo(0, 0);
    }
@ngdoc method
@name $anchorScrollProvider#disableAutoScrolling

@description
By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to
{@link ng.$location#hash $location.hash()} and scroll to the element matching the new hash.<br />
Use this method to disable automatic scrolling.

If automatic scrolling is disabled, one must explicitly call
{@link ng.$anchorScroll $anchorScroll()} in order to scroll to the element related to the
current hash.