Skip to content

Commit

Permalink
Fix issue when detecting if slide is visible
Browse files Browse the repository at this point in the history
The last slide offset was ceiled before comparing it to the dimensions
of the container which could cause problems when viewport size could
lead to the item end offset being 1px off.

Instead we floor the number to make sure it doesn't add that extra pixel.

Fixes #40
  • Loading branch information
tyom committed May 28, 2019
1 parent c22d1fa commit b102ce2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/assets/js/glider.min.js

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

2 changes: 1 addition & 1 deletion glider.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
}

var isVisible =
Math.ceil(itemStart) >= start && Math.ceil(itemEnd) <= end
Math.ceil(itemStart) >= start && Math.floor(itemEnd) <= end
slideClasses.toggle('visible', isVisible)
if (isVisible !== wasVisible) {
_.emit('slide-' + (isVisible ? 'visible' : 'hidden'), {
Expand Down
Loading

0 comments on commit b102ce2

Please sign in to comment.