fix footer position
I am trying to fix footer at bottom开发者_JS百科 in iPad using the code
$(window).scroll(function(){
var offsetY = window.pageYOffset;
var winHeight = $(window).height();
$('#footer').css({top: (winHeight+offsetY-60)+'px'});
});
where 60 is the height of footer. Its working fine but while scrolling (untill not finished) the footer's top position does not change, is there any way I can now that scroll has started? so that I can move the footer immediately or hide it while scrolling.
you can do this by using only CSS don't use jQuery for that
#footer{
position:fixed;
left:0px;
bottom:0px;
height:20px;
width:100%;
background:#999;
}
/* For ie 6*/
* html #footer{
position:absolute;
top:expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px');
}
精彩评论