From 5e03c92d435abc3c97f4f93a1ba558a0fa6a44d6 Mon Sep 17 00:00:00 2001 From: Stefan Date: Thu, 3 Jan 2019 15:08:08 +0100 Subject: [PATCH] Change $root to html and only use visible element By changing $root from body to html the scrolling is fixed ( see https://stackoverflow.com/questions/46071588/chrome-61-jquery-scrolling-not-working-anymore ). Affects #190 and #195 If the sel option is used an leads to a hidden element, the positioning will not work. As a quickfix you can make sure that only visible elements are selected by adding :visible to the CSS selector. Affects #168 Please note that these changes have not been tested on various browsers and the ':visible' change is a bit dirty. But the changes worked for me so far and i wanted them documented for everyone else. --- src/trip.core.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/trip.core.js b/src/trip.core.js index 2f8056f..fa723c0 100644 --- a/src/trip.core.js +++ b/src/trip.core.js @@ -127,7 +127,7 @@ function Trip() { this.$tripBlock = null; this.$overlay = null; this.$bar = null; - this.$root = $('html>body'); + this.$root = $('html'); // save the current trip index this.tripDirection = 'next'; @@ -963,7 +963,7 @@ Trip.prototype = { }); } - var $sel = $(o.sel); + var $sel = $(o.sel + ':visible'); var selWidth = $sel && $sel.outerWidth(); var selHeight = $sel && $sel.outerHeight(); var blockWidth = $tripBlock.outerWidth();