Jump to content
Six_Actual

Sticky element to top on scroll

Recommended Posts

I am trying to make my div (floating-sidebar) appear at the top when the user scrolls down the page, and once the user scrolls to the top, the element should not overlap the nav bar.

I am struggling to implement this, so help would be appreciated. This is what I have tried:

 <div id="floating-sidebar-sticky-wrapper" class="floating-sidebar-wrap" style="height: 696px;">
 <div id="floating-sidebar"></div>
</div>


 <script>
    $(window).on('load',function(){
      $("#floating-sidebar").sticky({ topSpacing: 0, wrapperClassName: "floating-sidebar-wrap" });
    });
  </script>

Share this post


Link to post
Share on other sites

Let's leave it to stackoverflow to to answer before we waste our time on you.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.