From dbdae96312bcccd0820d8ee43c088d5d6a1fab14 Mon Sep 17 00:00:00 2001 From: Daniel Ruf Date: Thu, 29 Mar 2018 20:41:14 +0200 Subject: [PATCH 1/3] fix: always use absolute positioning to prevent jumping Orbit slider --- js/foundation.orbit.js | 5 ++--- scss/components/_orbit.scss | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/foundation.orbit.js b/js/foundation.orbit.js index 38b8379048..7d34a897f1 100644 --- a/js/foundation.orbit.js +++ b/js/foundation.orbit.js @@ -344,11 +344,10 @@ class Orbit extends Plugin { if (this.options.useMUI && !this.$element.is(':hidden')) { Motion.animateIn( - $newSlide.addClass('is-active').css({'position': 'absolute', 'top': 0}), + $newSlide.addClass('is-active'), this.options[`animInFrom${dirIn}`], function(){ - $newSlide.css({'position': 'relative', 'display': 'block'}) - .attr('aria-live', 'polite'); + $newSlide.attr('aria-live', 'polite'); }); Motion.animateOut( diff --git a/scss/components/_orbit.scss b/scss/components/_orbit.scss index 9b43fcdd45..988c291dcf 100644 --- a/scss/components/_orbit.scss +++ b/scss/components/_orbit.scss @@ -67,6 +67,7 @@ $orbit-control-zindex: 10 !default; /// Adds styles for the individual slides of an Orbit slider. These styles are used on the `.orbit-slide` class. @mixin orbit-slide { width: 100%; + position: absolute; &.no-motionui { &.is-active { From cf80a487b29520a04853b440b926f993f8a7f012 Mon Sep 17 00:00:00 2001 From: Daniel Ruf Date: Sat, 7 Apr 2018 00:22:06 +0200 Subject: [PATCH 2/3] fix: render slide as block element --- js/foundation.orbit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/foundation.orbit.js b/js/foundation.orbit.js index 7d34a897f1..8901c6b4e3 100644 --- a/js/foundation.orbit.js +++ b/js/foundation.orbit.js @@ -347,7 +347,7 @@ class Orbit extends Plugin { $newSlide.addClass('is-active'), this.options[`animInFrom${dirIn}`], function(){ - $newSlide.attr('aria-live', 'polite'); + $newSlide.css({'display': 'block'}).attr('aria-live', 'polite'); }); Motion.animateOut( From 7daaba50ca72b3755451d5695bb07f2ecd15b60a Mon Sep 17 00:00:00 2001 From: Nicolas Coden Date: Wed, 11 Apr 2018 23:01:22 +0200 Subject: [PATCH 3/3] fix: remove position reset of Orbit slides preventing the "full-absolute" new behavior All Orbit slides should always have an `absolute` positioning to prevent jumping Orbit slider (see #11107). The `'position': 'relative'` reset is no longer necessary here and break the Orbit behavior as inline styles overrides `.orbit-slide` class styles. See: * https://github.com/zurb/foundation-sites/pull/11107/commits/dbdae96312bcccd0820d8ee43c088d5d6a1fab14 * https://github.com/zurb/foundation-sites/pull/11107 --- js/foundation.orbit.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/foundation.orbit.js b/js/foundation.orbit.js index 8901c6b4e3..41ef15f27d 100644 --- a/js/foundation.orbit.js +++ b/js/foundation.orbit.js @@ -149,8 +149,9 @@ class Orbit extends Plugin { temp = this.getBoundingClientRect().height; $(this).attr('data-slide', counter); - if (!/mui/g.test($(this)[0].className) && _this.$slides.filter('.is-active')[0] !== _this.$slides.eq(counter)[0]) {//if not the active slide, set css position and display property - $(this).css({'position': 'relative', 'display': 'none'}); + // hide all slides but the active one + if (!/mui/g.test($(this)[0].className) && _this.$slides.filter('.is-active')[0] !== _this.$slides.eq(counter)[0]) { + $(this).css({'display': 'none'}); } max = temp > max ? temp : max; counter++;