I want to smooth scroll to each of the a hrefs in the box class. My index.razor page is as follows...
<html>
<body>
    <div class="sidebar">
        <ul class="box">
            <li><a href="#home"><img class="icon"></a>O</li>
            <li><a href="#info"><img class="icon"></a>O</li>
            <li><a href="#blog"><img class="icon"></a>O</li>
            <li><a href="#contact"><img class="icon">O</a></li>
        </ul>
    </div>
    <div class="underlay">
        <section id="home">
            <h1>Hello!</h1>
        </section>
        <section id="info">
            <h1>About</h1>
        </section>
        <section id="blog">
            <h1>Service</h1>
        </section>
        <section id="contact">
            <h1>Contact</h1>
        </section>
    </div>
<script>
    $(".sidebar a").on('click', function (event) {
            if (this.hash !== "") {
    
                event.preventDefault();
    
                var hash = this.hash;
                $('html, body').animate({
                    scrollTop: $(hash).offset().top
                }, 800, function () {
                    window.location.hash = hash;
                });
            }
        });
</script>
I've tried using interop and to run the script. I believe the script is running before Blazor has compiled. Any idea how to fix this?
 
    