Search code examples
htmlcsswebpreloader

Full page White background preloader fade in on link click (example)


i was curious on how to do that to apply this on my webpage, if you can see this website :http://www.dynamicworks.eu/ and click on any link at the top, you will notice a smooth fade in white background is appeared. If anyone can tell me how to do it i would be very glad :)


Solution

  • Follow Below code snippet to make it work. Please feel free to ask your queries.

    $('.faded-div').fadeOut(2000);
    $('a.fade-in').click(function(){
        $('.faded-div').fadeIn(2000);
    });
    $('a.fade-out').click(function(){
        $('.faded-div').fadeOut(2000);
    });
    .faded-div{
        position: fixed;
        z-index: 999999;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color:blue ; 
        display: none;
    }
    .faded-div a
    {
      color:white;
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <div class="faded-div"><a href="#" class="fade-out">Click To FadeOut</a></div>
      <a href="#" class="fade-in">Click To FadeIn</a>