Skip to content

Commit

Permalink
Merge pull request ganlanyuan#4 from justia/priscila-paginationfix
Browse files Browse the repository at this point in the history
Live Push 2021-07-03: fix visible slide range calculation
  • Loading branch information
priscilamtzfraire authored Jul 5, 2021
2 parents 8c8093e + ce18723 commit 5894b9e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@justia/tiny-slider",
"version": "2.9.4",
"version": "2.9.5",
"description": "Vanilla javascript slider for all purposes, inspired by Owl Carousel.",
"keywords": [
"slider",
Expand Down
10 changes: 5 additions & 5 deletions src/tiny-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -1712,9 +1712,9 @@ export var tns = function(options) {

function getLiveRegionStr () {
var arr = getVisibleSlideRange(),
start = arr[0] + 1,
end = arr[1] + 1;
return start === end ? arr[0] : arr[0] + ' to ' + arr[1];
start = getAbsIndex(arr[0]) + 1,
end = getAbsIndex(arr[1]) + 1;
return start === end ? start : `${start} to ${end}`;
}

function getVisibleSlideRange (val) {
Expand Down Expand Up @@ -1779,8 +1779,8 @@ export var tns = function(options) {
}
}

start = getAbsIndex(Math.max(start, 0)) + 1;
end = getAbsIndex(Math.min(end, slideCountNew - 1)) + 1;
start = Math.max(start, 0);
end = Math.min(end, slideCountNew - 1);
}

return [start, end];
Expand Down

0 comments on commit 5894b9e

Please sign in to comment.