Sometimes we add too much code in a web page and this causes the page to flicker. What it means is that imagine we have created a webpage that needs to show/hide some div part on a user clicking a dropdown.
Once we submit the data to our server (say SQl) the page gets reposted and all elements of default page becomes visible including some content of the page that should not be visible becomes visible for a few seconds.
In order to prevent flickering we can add the below code under tag:
<script type=”text/javascript”>
- document.write('<style type="text/css">body{display:none}</style>');
- jQuery(function ($) {
- $('body').css('display', 'block');
- });
Qhorin HalfhandPosted Feb 1, 2021, 2:29 PM
Waste of time
sibadutta NayakPosted Dec 4, 2018, 7:27 AM
The above code is not working.
Uday KrishnaPosted Feb 21, 2018, 2:43 AM
I mean nothing showing on the screen im getting white page
Uday KrishnaPosted Feb 21, 2018, 2:42 AM
When i apply this code complete page is geeting hide