Skip to content
This repository has been archived by the owner on Sep 11, 2022. It is now read-only.

Can't seem to find a way to Put my element sticky at the bottom #293

Open
Crunchyman-ralph opened this issue Feb 18, 2020 · 0 comments
Open

Comments

@Crunchyman-ralph
Copy link

I tried to use bottomSpacing: 0 , but the element stays on top.

Here is my code, I used the example html:

<!doctype html>
<html>
<head>
  <title>Sticky Plugin</title>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  <script type="text/javascript" src="jquery.sticky.js"></script>
  <script>
    
    $(window).load(function(){
      $("#header").sticky({ topSpacing:0,
                           bottomSpacing:0
                          });
    });
    
    $(window).scroll(function(){
      position = $(".dickydick").offset().top -$("#header").height();
      if ($(window).scrollTop() > position) $("#header").unstick();
      else $("#header").sticky();
    });
  </script>
  <style>
    body {
      height: 10000px;
      padding: 0;
      margin: 0;
    }

    #header {
      background: #bada55;
      color: white;
      font-family: Droid Sans;
      font-size: 18px;
      line-height: 1.6em;
      font-weight: bold;
      text-align: center;
      padding: 10px;
      text-shadow: 0 1px 1px rgba(0,0,0,.2);
      width:100%;
      box-sizing:border-box;
    }
  </style>
</head>
<body>
  <div class="header-sticky-wrapper" style="">
  <p>This is test this is text this is text at the top.</p>
  <div id="header">
    <p>This is the sticky thingy that is really cool.</p>
  </div>
  <p style="margin-top:200vh">This is test this is text this is text at the bottom.</p>
    </div>
  <div class="blockdiv">
    
  </div>
</body>
</html>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant