javascript - jQuery: Refresh page with fadein and fadeout -


i have snippet make page refresh every minute. however, want page fade out specific color, refresh , fade in again. easy way that?

this code use;

setinterval("refresh();",60000);  function refresh(){   window.location = location.href;  } 

i found code while searching solution, unsure on how can use in interval;

$("body").fadeout(   function(){   location.reload(true);  $( document).ready( function(){$(body).fadein();});  }); 

demo

add css hide body on page load.

body{display:none}; 

then on load, fade body in.

after 60 seconds fade out, trigger page reload putting inside callback executes after fadeout finishes.

$(function(){     $('body').fadein(1000);     settimeout(function(){         $('body').fadeout(1000, function(){             location.reload(true);         });     }, 60000); }); 

no need use setinterval page gets reloaded; settimeout fine.


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -

java - How can I send the data from a imput type="file" to the controller? -