Search code examples
javascripthtmljquerycssfadein

Can`t figure out how fadein my div with jQuery


Obv

<script src="js/jquery-3.5.1.min.js"></script>
<script src="js/scripts.js"></script>

I have a link that point to a section down the page

<a id="seemore" class="seemore" href="#down">SEE MORE</a>

the css for the div that i want to fade in while moving to it

#down {
  margin-top: 100%;
  justify-content: center;
  visibility: hidden;
 }

but my script doesnt work :(

$("#seemore").click(function(){
  $("#seemore").fadeOut("fast");
  $("#down").fadeIn("slow");
});

Building this site in local


Solution

  • I this one is your looking for?

    $(document).ready(function(){
    $("#seemore").click(function(){
      $("#seemore").fadeOut("fast");
      $("#down").fadeIn("slow");
    });
    });
    #down {
     display:none;
     }
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    
    <a id="seemore" class="seemore" href="#down">SEE MORE</a>
    
    <p id="down" >Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...</p>