Fix slider max to match maximum attainable value.
[quanweb.git] / js / src / SearchController.js
index a4f4e4a72ace1bb3ade06e88610cb78dc8111d39..a02d27bae05f905187ce3306fb9c928e627c72fe 100644 (file)
@@ -28,11 +28,13 @@ var SearchController = (function () {
                 booksModel.ids = jsonValue;
                 booksModel.count = booksModel.ids.length;
                 booksModel.first = (-1);
+
+                const max_pos = Math.max(0, booksModel.count - booksModel.pageSize);
         
                 var elem = Browser.getElementById('slider');
-                elem.max = booksModel.count;
+                elem.max = max_pos;
                 elem = Browser.getElementById('bottom_slider');
-                elem.max = booksModel.count;
+                elem.max = max_pos;
         
                 PagingController.adjustPos(0);
             })