Scroll to anchor




    The code creates an anchor element by querying the location hash of the current document and then animates the scrollTop property of the anchor element to be 100 pixels above the location hash.

    $(document).ready(function() {
      var anchor = window.location.hash;
      $('html,body').animate({scrollTop: $(`${anchor}`).offset().top - 100}, 'slow');
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.