fadeout and removechild on load

Viewed 328

I am quite new to scripting, and I am attempting to implement a fading loadscreen on a new site.

When I target the parent div of the load screen (load_screen) and add fadeout and removeChild, the fadeout looks as I'd like it to, but then reappears instead of being removed. How can I change this code?

 <script>
window.addEventListener("load", function(){
      var load_screen = document.getElementById("load_screen");
      document.body.fadeOut(load_screen);
      document.body.removeChild(load_screen);
});
</script>
1 Answers
Related