Loader Jquery 3.2.1 / Bootstrap 4.0

0
<style>
.loader {
    position: fixed;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: url('load.gif') 50% 50% no-repeat rgb(249,249,249);
}
</style>

In body:

<div class="loader">

<script type="text/javascript">
    //  Jquery 3.x
    $(window).on('load', function() {
    $(".loader").fadeOut("slow");
    });
</script>

I can not make it work in version 3. Thanks

Edit: The idea is to load an animation while loading the content of the web. (a loader)

The animation should disappear when loading the web. With version 1.x, there were no problems, when migrating to version 3.x and adapting the content, some things worked, others did not.

    
asked by Marisa Avast 30.01.2018 в 10:27
source

1 answer

0

Here a loader is loaded using jquery 3.2.1 Everything works correctly, then the failure of your application is not in the use of jquery 3.2.1 for this.

 $(window).on('load', function() { 
    $(".loader").fadeOut("slow");
 });
.loader {
    position: fixed;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: url('https://mir-s3-cdn-cf.behance.net/project_modules/disp/09b24e31234507.564a1d23c07b4.gif') 50% 50% no-repeat rgb(249,249,249);
}

La version 3 de jquery funciona en este ejemplo.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<div class="loader">
    
answered by 31.01.2018 в 15:41