Search code examples
htmlcssanchor

How to hide Anchor icon when jump to specific part of page


I have arrow down click to jump to a specific part of page, click to scroll fuction is working but I need when click on icon then jump to a specific arrow down icon will hide.

.scroll-regform, .mobile {
    display: block!important;
}
.scroll-regform {
    position: fixed;
    right: 44%;
    top: 200px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    z-index: 3;
    line-height: 30px;
    text-align: center;
    color: #fff;
    font-size: 28px;

}
 <a href="#scroll-regform" href="#" class="scroll-regform"><i class="fa fa-angle-down animated-menu bounce" aria-hidden="true" alt="download" class="pt-8"></i></a>
 
 <div class="col-md-7" id="scroll-regform">
 <p>content</p>
 </div>


Solution

  • $( ".scroll-regform" ).click(function() {
      $(this).addClass('hideIcon')
    });
    .scroll-regform, .mobile {
        display: block!important;
    }
    .scroll-regform {
        right: 44%;
        top: 200px;
        cursor: pointer;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        z-index: 3;
        line-height: 30px;
        text-align: center;
        font-size: 28px;
    
    }
    .scroll-regform.hideIcon{
      display: none !important;
    }
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <a href="#scroll-regform" href="#" class="scroll-regform"><i class="fa fa-angle-down animated-menu bounce" aria-hidden="true" alt="download" class="pt-8">ICON</i></a>
     
     <div class="col-md-7" id="scroll-regform">
     <p>content</p>
     </div>