Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: always use absolute positioning to prevent jumping Orbit slider #11107

Merged
merged 3 commits into from Apr 12, 2018
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions js/foundation.orbit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down Expand Up @@ -344,11 +345,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.css({'display': 'block'}).attr('aria-live', 'polite');
});

Motion.animateOut(
Expand Down
1 change: 1 addition & 0 deletions scss/components/_orbit.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down