Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created May 10, 2012 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walterdavis/2653912 to your computer and use it in GitHub Desktop.
Save walterdavis/2653912 to your computer and use it in GitHub Desktop.
var moving = false;
var h = $('footer').getHeight();
var base = ($('box').getLayout().get('bottom') * -1);
var nearBottom = function(){
var scrolled = document.viewport.getScrollOffsets()[1];
return ((scrolled + 80) > base);
}
var peek = function(){
if(!!moving) return;
if(nearBottom()){
moving = true;
$('footer').morph('height:' + h + 'px', {
duration:0.4,
afterFinish: function(){
moving = false;
}
});
}else{
moving = true;
$('footer').morph('height: 14px', {
duration:0.4,
afterFinish: function(){
moving = false;
}
});
}
}
if(!nearBottom()){
$('footer').setStyle('height:14px; overflow:hidden');
new PeriodicalExecuter(peek, 0.1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment