Skip to content

Commit

Permalink
Change $root to html and only use visible element
Browse files Browse the repository at this point in the history
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 EragonJ#190  and EragonJ#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 EragonJ#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.
  • Loading branch information
phroggar committed Jan 3, 2019
1 parent d8766cf commit 5e03c92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/trip.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 5e03c92

Please sign in to comment.