开发者

Bottom floating div (like in facebook messages)

I'm looking for some type开发者_如何学运维 of css (maybe jquery) solutions where the div would always stay at the bottom of the sreen - like this is done on facebook -> view messages -> individual message conversation. The "Reply" box always stays at the bottom and when you scroll to the top to see previous messages the reply box also moves up.

thanks


HTML:

    <body>
        <div id="footer"></div>
    </body>

CSS:

#footer {
    position:fixed;
    bottom:0;
    height:100px;
    width:100%;
}

jQuery to scroll to bottom on load:

$(function(){
    $("body").animate({scrollTop: $(this).height()}, 1000); 
});

http://jsfiddle.net/AlienWebguy/CCpJg/5/


Why not using CSS fixed positioning?

#bottomDiv
{
   position: fixed;
   right: 50px;
}


you can use the css property

div.theItem {
   position: fixed;

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜