0

I am building the following layout which can be viewed here:

http://www.freemicsnyc.com/Other%20Versions%20&%20Backup/FreemicsNJ/new_template.html

You will notice the one div with the days of the week (mon, tues, wed, ..) does not scroll with the rest of the page since it is styled with the following css:

.column_headings{

    ...not important stuff

    position: absolute;
    margin: 416px auto 0 auto;
    left:0;
    right:0;
}

This behavior is not what Im looking for.

What I would like, is for that div to scroll along with the rest of the page like normal until it gets to the very top of the viewport, at which point it would stay there like a sticky header as the remainder of the content scrolls beneath it.

Would I need parallax scrolling for this? JQuery? Is there a way to do it with just CSS?

Any help would be much appreciated!

Mary624
  • 75
  • 9

2 Answers2

0

You can use a jQuery plugin such as: http://stickyjs.com/ for now as the full css implementation of this, position: sticky has very low browser support as of the moment.

DigitalDouble
  • 1,747
  • 14
  • 26
0

Replace your CSS code with below and see if it helps:

CSS

  width: 970px;
  height: 60px;
  background: lime;
  text-align: center;
  white-space: nowrap;
  position: relative;
  margin: 0 auto 0 auto;
  left: 0;
  right: 0;
  border-top: 1px solid black;
  border-bottom: 1px solid black;
  display: block;
divy3993
  • 5,732
  • 2
  • 28
  • 41
  • @Mary624 i have tried and it worked for me by modifying to above posted code, still any issues feel free to ask. – divy3993 May 22 '15 at 02:45
  • thank you divy3993. I have tried swapping in that code but it only brings the element to the top. http://www.freemicsnyc.com/Other%20Versions%20&%20Backup/FreemicsNJ/new_template.html I am trying to get to scroll with the page until it gets to the top, then stay there as the other content keeps scrolling under – Mary624 May 22 '15 at 05:04