]> _ Git - fluidbook-html5.git/commitdiff
wip #4866 @0:05
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 12 Nov 2021 14:06:08 +0000 (15:06 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 12 Nov 2021 14:06:08 +0000 (15:06 +0100)
js/libs/fluidbook/fluidbook.js

index 098c53e0be4f95018c510e92d2b728bbc89aa28d..8632f5ba72e4e9000b733d3daa9d12bbca38de62 100644 (file)
@@ -432,8 +432,8 @@ Fluidbook.prototype = {
         } else if (args[1] === 'page') {
             var anchor = false;
             if (fluidbook.settings.pageLabels[args[2]] !== undefined) {
-                page = fluidbook.settings.pageLabels[args[2]];
-                anchor = args[2];
+                anchor = this.normalizeAnchor(args[2]);
+                page = fluidbook.settings.pageLabels[anchor];
             } else {
                 page = parseInt(args[2]);
             }
@@ -503,11 +503,15 @@ Fluidbook.prototype = {
         return;
     },
 
+    normalizeAnchor: function (anchor) {
+        return anchor.toLowerCase().replace('/-/g', '');
+    },
+
     scrollToAnchor: function (anchor) {
         if (!this.mobilefirst.enabled) {
             return;
         }
-        anchor=anchor.toLowerCase().replace('/-/g','');
+        anchor = this.normalizeAnchor(anchor);
         var id = $('[data-anchor="' + anchor + '"]').attr('id');
         TweenMax.to($("#scroll"), 0.5, {scrollTo: {y: '#' + id, offsetY: $('header').outerHeight() + 10}});
     },