From 2014.igem.org
(Difference between revisions)
|
|
Line 37: |
Line 37: |
| } | | } |
| | | |
- | #menu {} | + | #menu { |
- | | + | |
- | .fixed {
| + | |
| position:fixed; | | position:fixed; |
| top:0px; | | top:0px; |
- | z-index:10; | + | z-index:1000; |
| } | | } |
| | | |
Line 67: |
Line 65: |
| </div> | | </div> |
| | | |
- | <script>
| |
- | $(document).ready(function() {
| |
- | //change the integers below to match the height of your upper dive, which I called
| |
- | //banner. Just add a 1 to the last number. console.log($(window).scrollTop())
| |
- | //to figure out what the scroll position is when exactly you want to fix the nav
| |
- | //bar or div or whatever. I stuck in the console.log for you. Just remove when
| |
- | //you know the position.
| |
- | $(window).scroll(function () {
| |
- |
| |
- | console.log($(window).scrollTop());
| |
- |
| |
- | if ($(window).scrollTop() > 50) {
| |
- | $('#menu').addClass('fixed');
| |
- | }
| |
- |
| |
- | if ($(window).scrollTop() < 51) {
| |
- | $('#menu').removeClass('fixed');
| |
- | }
| |
- | });
| |
- | });
| |
- | </script>
| |
| | | |
| </body> | | </body> |
| </html> | | </html> |
Revision as of 21:27, 24 July 2014