Tiny-slider: Flickering effect on load

Created on 24 Jul 2019  路  3Comments  路  Source: ganlanyuan/tiny-slider

All slides are visible from the point when page loads until the slider becomes active, which causes a flickering effect. Owl slider hides all slides until slider becomes active and shows only active slide then on. It is a css issue and I tried to come up with a solution in tiny-slider.scss but alas, couldn't figured out the right place to hide all slides and show active one only.

Most helpful comment

This is what I'm using:

// Prevent flickering during initialization
.your-slider-class {
  opacity: 0;

  &.tns-slider {
    opacity: 1;
  }
}

All 3 comments

One way you could solve this problem is by setting the opacity of your slider to 0 and then use tiny-slider's onInit function to add a css class to the slider that sets the opacity back to 1 once the slider is fully loaded.

@snnsnn After implementing fadeIn/fadeOut for my gallery I realized the conflict is between the opacity transition and .tns-gallery > .tns-item under ./src/tiny-slider.scss#L60
I fixed overriding the rule, like:

  /* Opacity causes animation conflict with Animate.css */
.tns-gallery > .tns-item {
  -webkit-transition: transform 0s;
  -moz-transition: transform 0s;
  transition: transform 0s;
}

This is what I'm using:

// Prevent flickering during initialization
.your-slider-class {
  opacity: 0;

  &.tns-slider {
    opacity: 1;
  }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

cyocun picture cyocun  路  4Comments

DimaGashko picture DimaGashko  路  3Comments

craigryan picture craigryan  路  5Comments

youradds picture youradds  路  3Comments

nireve picture nireve  路  4Comments