JSFiddle - React, Tailwind, and code Playground

by ps1panda

HTML

<!--Появление элемента при прокрутке на чистом javascript-->
<div class="main">
  <script>
window.onscroll = function() {
  if(window.pageYOffset>300){
    document.getElementById('elem').style.display="block";

  }
  else{
     document.getElementById('elem').style.display="none";
  }
}
  </script>

  <div id='elem'></div>
</div>

CSS

.main{
    height:5200px;
  }
  #elem{
    width:100px;
    height:100px;
    background:red;
    position:fixed;
    right:30px;
    bottom:30px;
    display:none;
  }