jquery - Getting a fixed footer to expand height from top to bottom on scroll -
i have page - here fixed footer. main content #mid.stages > .stages
scrolls behind footer, , using jquery waypoints when scroll bottom of page footer needs gain height (from top down) , section #topfooter
needs expand top down reveal contents. have been trying various solutions no avail, namely due fact when loaded footer has fixed position , 'reveal' part of outside browser window.
$(function(){ var position = function () { var w = $(window).height(); //var f = $('footer').height(); var foo = (w-110); console.log(foo); $('footer').css('top', foo); }; $(document).ready(position); $(window).resize(position); $('#mid').waypoint(function(direction) { var stagepos = $('.stage').position(); if (direction === 'down') { //$('footer').animate({height:'600px', top:'stagepos.top'},300,'swing', position); $('footer').css({'position':'absolute', 'height':'600px','top':'stagepos.top'}); $('.tfcontent').css({'height':'200px'}); $('p.extra').fadein('fast'); } else if (direction === 'up') { $('footer').css({'position':'fixed','top':'foo'}); $('.tfcontent').css({'height':'60px'}); $('p.extra').slideup('fast'); } position(); }, { offset: 'bottom-in-view' }); });
i need footer expand top down, doesn't cover content in #mid.stages > .stages
, pretty opposite of have now, , able use sort of animation it's not choppy now. push in right direction appreciated.
i noticed referring variables in between quotes. need remove quotes. in following lines:
$('footer').css({'position':'absolute', 'height':'600px','top':stagepos.top});
in line don't see variable foo, 1 see defined inside position function. unless have somewhere else in code, need replace calculation:
$('footer').css({'position':'fixed','top':$(window).height()-110});
also, noticed set top of footer top of first stage element , that's why grows upwards , covers content. suggest trying make footer position relative, height of 60px , animate growth 600px. stay below content , page grow contain it.
$('footer').css({'position':'relative', 'height':'60px'}).animate({'height':'600px'}, 400) ;
Comments
Post a Comment