Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions js/flickity.js
Original file line number Diff line number Diff line change
Expand Up @@ -761,9 +761,17 @@ proto.checkVisibility = function() {
var viewportX = this.viewport.getBoundingClientRect().x;
var viewportWidth = this.viewport.offsetWidth;

// Lorenza pulls content that should be out of the viewport in to
// force slides on either side of the viewport. We need to offset
// the viewport by the maximum amount it can be pulled in 4px.
if (this.options.wrapAround) {
viewportWidth = viewportWidth - 4;
}

this.cells.forEach(function (cell) {
var cellX = cell.element.getBoundingClientRect().x - viewportX;
var isVisible = (
(cellX > -1 && cellX < 1) ||
(cellX + cell.size.innerWidth > viewportX) && (cellX + cell.size.innerWidth < viewportWidth) ||
(cellX > viewportX) && (cellX < viewportWidth)
);
Expand Down