From 47cf6149967d80de409637ac63aa82a685526124 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Wed, 11 May 2011 18:53:59 -0700 Subject: [PATCH] sneaky fixed header --- public/javascripts/view.js | 10 ++++++++++ public/stylesheets/sass/application.sass | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/public/javascripts/view.js b/public/javascripts/view.js index 3e9eb2e68..2d91dd541 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -4,6 +4,16 @@ */ var View = { initialize: function() { + + $(window).scroll(function(){ + var header = $('header'); + if( $(this).scrollTop() > 30){ + header.addClass('fixit'); + } else { + header.removeClass('fixit'); + } + }); + /* Buttons */ $("input:submit").addClass("button"); diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index c724e8524..957abc475 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -136,11 +136,16 @@ header :top 2px :color #CCC - :position fixed + :position absolute + :width 100% :top 0 :left 0 + &.fixit + :position fixed + :top -30px + a :color #CCC