Skip to content

Commit 2e62e18

Browse files
committed
Making the title stick to the top when scrolled.
1 parent 5f76906 commit 2e62e18

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

javascripts/sidebar.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ $(function() {
5454
// Draw the sidebar
5555
redraw();
5656

57+
// sticky header
58+
var $title = $('section#main h1');
59+
var headOffset = 50;
60+
$(window).scroll(function(){
61+
if( $(window).scrollTop() > headOffset ) {
62+
$title.addClass("fixed_top");
63+
} else {
64+
$title.removeClass("fixed_top");
65+
}
66+
});
67+
5768
// Hide tutorials if the user clicks on a facet
5869
$("nav li").live("click", function(e) {
5970
target = $(this).data();

stylesheets/styles.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,18 @@ section#main {
201201
padding-bottom:50px;
202202
}
203203

204+
section#main h1.fixed_top{
205+
position:fixed;
206+
top:0px;
207+
z-index:100;
208+
width: 560px;
209+
padding: 10px 0;
210+
-moz-box-shadow: 0px 5px 10px #FFF;
211+
-webkit-box-shadow: 0px 5px 10px #FFF;
212+
box-shadow: 0px 5px 10px #FFF;
213+
background:#FFF;
214+
}
215+
204216
small {
205217
font-size:11px;
206218
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy