Commit 115e4f15 authored by Tatiana's avatar Tatiana
Browse files

Issue #3281702 by tatianag: Fix scrolling to top of page

parent f05d871b
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -89,9 +89,7 @@
        $("ul.pagination").removeClass('hidden');

        $("#multipage-previous").click(function () {

          $("html, body").animate({scrollTop: $("#content").offset().top}, "fast");

          // Show the previous section, hide the current one.
          var previousItem = null;
          if ($(".chunker-section:visible").prev().length !== 0) {
            previousItem = $(".chunker-section:visible").prev();
@@ -103,13 +101,13 @@
            $(".chunker-section:visible").hide();
            previousItem.show();
          }
          scrollTop();

          return false;
        });

        $("#multipage-next").click(function () {

          $("html, body").animate({scrollTop: $("#content").offset().top}, "fast");

          // Show the next section, hide the current one.
          var nextItem = null;
          if ($(".chunker-section:visible").next().length !== 0) {
            nextItem = $(".chunker-section:visible").next();
@@ -121,10 +119,18 @@
            nextItem = $(".chunker-section:first");
            nextItem.show();
          }
          scrollTop();

          return false;
        });
      }

      function scrollTop() {
        // Make the correct focus point in the HTML.
        logger('scrolling to top...');
        $("html, body").animate({scrollTop: $(".chunker-section:visible").offset().top}, "fast");
      }

      function logger(message) {
        const prefix = 'sector_multipage: ';
        const debug = false;