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.

Issues with domready—animation flickering on page load.

See original GitHub issue

I’m having a hard time getting around an issue that I think has to do with domready. Each time I load my site (https://piotrf.pl) the plain keyframe CSS animations are being triggered twice, which causes an awkward flickering: https://s3-us-west-2.amazonaws.com/dropbox.piotrf.pl/Untitled.mov

Note how this flickering occurs only on server, not on hotloaded localhost. Here’s why I think domready might be involved:

screen shot 2017-11-29 at 12 45 03 screen shot 2017-11-29 at 12 44 50

Has anyone encountered a similar issue?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:59 (28 by maintainers)

github_iconTop GitHub Comments

4reactions
malekjaroslavcommented, Mar 20, 2018

I have the same problem

2reactions
migs540commented, Nov 30, 2017

@KyleAMathews we all win when you are awake.

In short: animations are executed twice. Once in index.html then a second time in componentindex.js:

I added console logging and can see the render is triggered just once in js (in component—src-pages-index-js-2d6cb1471a0df592f43f.js):

…E=(0,T.keyframes)(f),x=t.AboutContents=k.default.div(d,E),A=function(t){function n(){return(0,o.default)(this,n),(0,i.default)(this,t.apply(this,arguments))}return(0,u.default)(n,t),n.prototype.render=function(){return console.log(“IndexComponent triggered me during render”),e.createElement…

class IndexComponent extends React.Component {
  render() {
    console.log("IndexComponent triggered me during render")

but well before that the animation is triggered (presumably from index.html:

public 3Legs$ grep animation index.html 
.iVIEdg{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform:translateX(-100%);-webkit-animation:cWOgti 1s forwards;animation:cWOgti 1s forwards;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;position:relative;z-index:10;box-shadow:8px 8px rgba(0,0,0,0.15);}
.hzuIAT{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);-webkit-transform:translateX(-100%);-webkit-animation:cWOgti 1s forwards;animation:cWOgti 1s forwards;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;position:relative;z-index:10;box-shadow:8px 8px rgba(0,0,0,0.15);}

Video of behaviour (chrome dev tools) at:

http://trustingcustomers.com/consolelogging.mp4

Note: console logging is not in place in the repo I mention above - and you need to do a gatsby build to see the behaviour (gatsby develop triggers it just once because of the way it serves files locally).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stop flicker - Load CSS via javascipt but before dom ready?
Sometimes when Im using jquery to add css to the page this creates a flicker effect as the page loads first without javascript, ......
Read more >
How to Prevent flicker problem in css animation?
That's because the images haven't loaded, and they only start loading when the animation starts. To prevent this flickering, you can use the ......
Read more >
flicker on first load - Banner Animation - GreenSock
Hi guys, I have been working on some banners over the past few days. I have setup an init() function which positions all...
Read more >
Javascript 'Flicker' on page load | Community Support
I'm using a 'News Ticker' script that fades a feed of latest news stories in and out on the top of my page....
Read more >
Smooth scroll issues and flashing items | Themeco Community
In addition to this, items that have loaded on the portfolio and the blog page (after the loading animation) flicker once or twice...
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