JSFiddle - React, Tailwind, and code Playground

by nikolya223

HTML

<div class="layer1 paralax">
   <div>
    <div class="quadra">
        
    </div>
   </div> 
</div>

CSS

body,html{
    width: 100%;
    height: 100%;
}
.paralax>div{
    height: 3000px;
    
}
.layer1,.layer2,.layer3{
    background: rgba(0,0,0,0.2);
    position: fixed;
    top: 0px;
    left: 0px;
    width: 100%;
    overflow: hidden;
    height: 100%;
} 

.layer1{
    z-index: 1;
}
.layer2{
    z-index: 2;
}
.quadra{
    width: 50px;
    height: 50px;
    position: absolute;
    background: black;
}

JavaScript

var paralax = {};
    paralax.set ={};
    paralax.set.quadCount = 10;
(function(){
    for ( i = 0;i< paralax.set.quadCount;i++){
        var top  = Math.floor(Math.random() * (3000 - 0 + 1)) + 0;
        var left = Math.floor(Math.random() * (screen.availWidth - 0 + 1)) + 0;
        $(".layer1").append('<div class="quadra" style="top:'+top+';left:'+left+'"></div>')
    }
})();