question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flashing Background Image on Transition

See original GitHub issue

Applying the basic glide setup with slides that contain a background image causes a flicker when transitioning.

 <div class="glide" id="glide-header">
        <div class="glide__track" data-glide-el="track">
            <ul class="glide__slides">
                <li class="glide__slide FOO">A</li>
                <li class="glide__slide FOO">B</li>
            </ul>
        </div>
</div>

(Not sure if the background image is necessary, but relevant to my repro)

/* import core css for glide */

.FOO {
    background-image: url('../img/foo.png');
}
const Carousel = new Glide('#glide-header',
    Object.assign({}, glideConfig, {
      perView: 1,
      gap: 0,
      autoplay: 5000,
      hoverpause: false,
  }));

Carousel.mount();

If you let the slides play through, you’ll notice a flicker on Chrome (minimally).

I was able to fix this issue by overriding glide__slides as seen below. Any idea what might be happening here?

.glide__slide {
    /* Fix for flashing background image on slide */
    -webkit-transform: translate3d(0, 0, 0);
    -moz-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    -o-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:8

github_iconTop GitHub Comments

22reactions
cizzacommented, Oct 9, 2018

Hello,

I’ve noticed flickering of the image in Chrome with a normal images. Your fix didn’t help me, however my solution was quite a simple. I’ve added a z-index to the glide__slide–active class. z-index: 1 did the trick. I’ve noticed an issue when the active class gets applied to the slide index 0 after playing the whole sequence and my first guess was z-index. Hope that helps to someone.

1reaction
alexbarbatocommented, May 16, 2019

Kudos for trying and thanks for the effort @lifeinchords!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webkit: Flicker on CSS Transition with background image
The background of the .main container flickers on the CSS transition in all webkit browsers. Any of the solutions out there like: -webkit-backface-visibility ......
Read more >
Flickering when background image changes : r/Frontend
I want to make an animated background on my website. I decided to achieve that with css keyframe animation. The problem is flickering...
Read more >
How can I prevent flicker in a reactive background image ...
I have a div whose background image changes depending on a helper's return. Right now when there is a change it goes white...
Read more >
How to Create a Blinking Effect with CSS3 Animations - W3docs
In this tutorial, we'll demonstrate how to create a blinking effect for a text or background easily. To achieve this goal, you need...
Read more >
Delay your CSS animations to make them cleaner
CSS Transition animation can flicker on hover, this is how you can fix that! ... Engage Web profile picture; Pablo Lara H profile...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found