Answer the question
In order to leave comments, you need to log in
How to get rid of this effect?
Let's say I change the color backround-color: #232323!important;
loading script
$('html').attr('style', 'background-color:#232323!important');
$('body').attr('style', 'background-color:#232323!important');
html{
color:#fefefe;
background-color:#232323;
}
Answer the question
In order to leave comments, you need to log in
Initially, the page is white, and the script is not loaded and executed instantly. And while the script has not worked, the browser manages to draw a white background.
If you change it not with a script in the browser, but on the server side, then the delay can be reduced.
Enabling proper caching for css and js will also help, but even if it is inline css, it can still slip through on slow machines or with a bad connection.
In general, there are themes in chrome. Get yourself a dark one .
Why would you want to do it with a script? Just add with the right rules.
If you need some condition, then with a guarantee only something like this:<style>
<script>
if (true) {
document.write(`<style>
html, body {
background-color:#232323 !important
}
</style>`);
}
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question