diff --git a/docs/client/docs.js b/docs/client/docs.js index 4ecb004ab5..c878bc9013 100644 --- a/docs/client/docs.js +++ b/docs/client/docs.js @@ -47,10 +47,17 @@ Meteor.startup(function () { } var ignore_waypoints = false; - $('body').delegate('h1, h2, h3', 'waypoint.reached', function (evt, dir) { + var lastTimeout = null; + $('h1, h2, h3').waypoint(function (evt, dir) { if (!ignore_waypoints) { var active = (dir === "up") ? this.prev : this; - Session.set("section", active.id); + if (active.id) { + if (lastTimeout) + Meteor.clearTimeout(lastTimeout); + lastTimeout = Meteor.setTimeout(function () { + Session.set("section", active.id); + }, 200); + } } });