'How to change the visibility of a div when browser reloads?
I want to make the main div hidden when someone hits the refresh button and then after sometime making the main div visible. The reload detection code is working but why the div isn't getting hidden? CSS
#Web_1920__1 {
position: absolute;
width: 3554px;
height: 2346px;
border: 0px grey solid;
background-color: rgba(255,255,255,1);
visibility: visible;
overflow: visible;
}
JAVASCRIPT
//check for Navigation Timing API support
if (window.performance)
{
console.info("window.performance works fine on this browser");
}
console.info(performance.navigation.type);
if (performance.navigation.type == performance.navigation.TYPE_RELOAD)
{
console.info( "This page is reloaded" );
document.getElementById("Web_1920__1").style.visibility = "hidden";
setInterval(function()
{
document.getElementById("Web_1920__1").style.visibility = "visible";
}, 700);
}
else
{
console.info( "This page is not reloaded");
}
Setting the visibility hidden outside setInterval function not working. How can I fix this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|