Fix scrolling to the top on docs type switch

This commit is contained in:
Slava Kim
2014-10-27 13:22:44 -07:00
parent 339af2a607
commit 9a60c8eede
2 changed files with 4 additions and 2 deletions

View File

@@ -16,7 +16,7 @@
{{> topBar}}
<div class="main-content">
<div id="main">
<div id="top"></div>
<div><div id="top"></div></div>
<div class="{{layoutHidden 'full'}}">
{{> fullApiContent}}
</div>

View File

@@ -29,6 +29,8 @@ Meteor.startup(function () {
Tracker.afterFlush(function () {
$.waypoints('destroy');
// XXX this timeout is a temporary hack to yield more before setting the
// waypoints.
setTimeout(function () {
$('.main-content :not(.hidden) [id]').each(function (i, el) {
if (! $("#nav [href='#/" + docsType + '/' + el.id + "']").get(0)) {
@@ -89,7 +91,7 @@ Tracker.autorun(function () {
if (! id) {
// will scroll to the very top
id = "main";
id = "top";
}
// XXX this selector is tied to the structure of the document so tightly