fix(app): ensure headings are visible when navigating to in-page anchors

Closes #477
This commit is contained in:
Peter Bacon Darwin 2015-12-14 10:15:19 +00:00
parent 6dc9e5d10b
commit a6ca213866
4 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,4 @@
md-toolbar(class="main-nav background-regal l-pinned-top l-layer-5") md-toolbar(class="main-nav background-regal l-pinned-top l-layer-5",scroll-y-offset-element)
nav nav
h1 <a href="/" md-button>Angular <sup>by Google</sup></a> h1 <a href="/" md-button>Angular <sup>by Google</sup></a>

View File

@ -6,7 +6,7 @@ script(src="/resources/js/vendor/lodash.js")
<!-- Angular Material Dependencies --> <!-- Angular Material Dependencies -->
script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js") script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js")
script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.min.js") script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.min.js")
script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.min.js") script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.min.js")
script(src="https://ajax.googleapis.com/ajax/libs/angular_material/0.8.3/angular-material.min.js") script(src="https://ajax.googleapis.com/ajax/libs/angular_material/0.8.3/angular-material.min.js")
@ -24,6 +24,7 @@ script(src="/resources/js/directives/code.js")
script(src="/resources/js/directives/code-tabs.js") script(src="/resources/js/directives/code-tabs.js")
script(src="/resources/js/directives/code-pane.js") script(src="/resources/js/directives/code-pane.js")
script(src="/resources/js/directives/code-example.js") script(src="/resources/js/directives/code-example.js")
script(src="/resources/js/directives/scroll-y-offset-element.js")
<!-- GA --> <!-- GA -->

View File

@ -0,0 +1,5 @@
angularIO.directive('scrollYOffsetElement', ['$anchorScroll', function($anchorScroll) {
return function(scope, element) {
$anchorScroll.yOffset = element;
};
}]);

View File

@ -19,4 +19,8 @@ var angularIO = angular.module('angularIOApp', ['ngMaterial'])
.accentPalette('purple', { .accentPalette('purple', {
'default': '200' // use shade 200 for default, and keep all other shades the same 'default': '200' // use shade 200 for default, and keep all other shades the same
}); });
})
.config(function($locationProvider) {
$locationProvider.hashPrefix('!');
}); });