From c29510da20339b9f4e2675ccf3e3ad7681a38b11 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Wed, 13 May 2020 20:08:01 +0200 Subject: [PATCH] pat-scroll: Fix autoscroll with overflow-x/y pat-scroll: To define the scrollable target search also for overflow-x and overflow-y declarations. --- CHANGES.md | 1 + src/pat/scroll/scroll.js | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 89ff30a27..7c0279fbc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ Features ~~~~~~~~ +- pat-scroll: To define the scrollable target search also for `overflow-x` and `overflow-y` declarations. - Rework push message support for the STOMP message protocoll instead of backends instead of WAMP. We are using the RabbitMQ message broker for push support instead of crossbar.io. - Navigation: diff --git a/src/pat/scroll/scroll.js b/src/pat/scroll/scroll.js index 31a4525f9..651c93e81 100644 --- a/src/pat/scroll/scroll.js +++ b/src/pat/scroll/scroll.js @@ -137,7 +137,7 @@ define([ fragment = this.options.selector; } else { href = this.$el.attr('href'); - fragment = href.indexOf('#') !== -1 && '#' + href.split('#').pop() || undefined; + fragment = href.indexOf('#') !== -1 ? '#' + href.split('#').pop() : undefined; } var target = $(fragment); if (target.length === 0) { @@ -145,8 +145,11 @@ define([ } scrollable = $(target.parents().filter(function() { - return ( $(this).css('overflow') === 'auto' || - $(this).css('overflow') === 'scroll' ); + return ( + ['auto', 'scroll'].indexOf($(this).css('overflow')) > -1 || + (scroll === 'scrollTop' && ['auto', 'scroll'].indexOf($(this).css('overflow-y')) > -1) || + (scroll === 'scrollLeft' && ['auto', 'scroll'].indexOf($(this).css('overflow-x')) > -1) + ); }).first()) if ( typeof scrollable[0] === 'undefined' ) {