templates/topbar.js in mizuho-0.9.12 vs templates/topbar.js in mizuho-0.9.13

- old
+ new

@@ -6,10 +6,11 @@ var $title = $('#header h1'); var $currentSection = $('#current_section'); var isMobileDevice = this.isMobileDevice(); var timerId; + // Create the floating table of contents used in the top bar. var $floattoc = $('<div id="floattoc"></div>').html($('#toc').html()); $floattoc.find('#toctitle').remove(); $floattoc.find('.comments').remove(); $floattoc.css('visibility', 'hidden'); $floattoc.insertAfter($topbar); @@ -24,10 +25,12 @@ }); $floattoclinks.click(function(event) { self.internalLinkClicked(this, event); }); + // Callback for when the user clicks on the Table of Contents + // button on the top bar. function showFloatingToc() { var scrollUpdateTimerId; function reposition() { if (isMobileDevice) { @@ -116,10 +119,13 @@ $document.bind('touchdown', onMouseDown); $document.bind('mizuho:hideTopBar', hideFloatingToc); $window.bind('scroll', onScroll); } + // Called whenever the user scrolls. Updates the title of the + // Table of Contents button in the top bar to the section that + // the user is currently reading. function update() { if ($title.offset().top + $title.height() < $document.scrollTop()) { if (!$topbar.is(':visible')) { $topbar.slideDown(250); $document.trigger('mizuho:showTopBar'); @@ -158,9 +164,10 @@ timerId = setTimeout(function() { timerId = undefined; update(); }, 100); } + if (isMobileDevice) { // Mobile devices don't support position fixed. $topbar.css('position', 'absolute'); $floattoc.css('position', 'absolute');