Initial inline styles prevent timeline from rendering properly when not initially visible.
See original GitHub issueSo, here is my use case: I’m using react-router, and have several pages. On the first page, no timeline is being rendered. I switch to the second page where a timeline should be rendered, but it is not visible. I can inspect it, and see that the element is there, but it has an inline style on the .vis-timeline
element which sets it to hidden.
I can change the visibility using css or in code, but then it’s only visible and you cannot scroll or use the timeline.
The solution I found was to get the timeline in my componentDidMount
function, and then set the styles on .vis-timeline
to an empty string. For example:
componentDidMount() {
let timeline = document
.getElementById("uniqueId")
.getElementsByClassName('vis-timeline')[0];
timeline.style = "";
}
This was the only way I could get it to initialize correctly. This may be related to #38 as well.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:8 (2 by maintainers)
Top Results From Across the Web
visibility - CSS: Cascading Style Sheets - MDN Web Docs
The visibility CSS property shows or hides an element without changing the layout of a document. The property can also hide rows or...
Read more >Improve site performance by inlining your CSS - LogRocket Blog
As one developer's benchmark indicates, inline-styling every HTML element significantly affects the time to first contentful paint.
Read more >Should CSS always precede JavaScript? - Stack Overflow
While it makes sense to block all rendering for stylesheets (so you get the correct styling the first time and avoid the flash...
Read more >How to Load Fonts in a Way That Fights FOUT and Makes ...
That means using bare minimum presentation styles (i.e. inlined critical CSS) in the loading process. That is also why web fonts are considered ......
Read more >Optimize CSS Delivery | PageSpeed Insights
Before the browser can render content it must process all the style and layout information for the current page. As a result, the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@daumann - Sorry for the delay on this. We’ve super busy the last few months and have dropped the ball on this one. We’ll try and have a quick look tomorrow! 👍
Is there a really simple example someone can build to reproduce this, without having to pull in react-router?