I’m trying to do a footer the shows behind the content when scrolling towards the end of the website, it’s hard to explain so I did this gif
http://imageshack.us/f/687/newdw.gif/
I’ve tried to search around the web for tutorials and what I find is not what I’m looking for (all I’ve seen is slide up and slide down footer).
Would help a lot, if you can point me to a tutorial or explain how to do it.
The following should do what you want, using only css.
http://jsfiddle.net/zVLrb/
This solution relies on the way elements with
position:fixedbehave. This code will mean that on shorter pages – i.e. ones that do not cause a scroll bar to appear, the footer will remain fixed to the bottom of the page, rather than the content.Basically the footer is always attached to the bottom of the window/viewport, as the user scrolls, but for the majority of the time you can’t see it because the rest of the page is floating above it – this is caused by using a higher z-index for the page content than the footer. By using a bottom margin the same height as the footer, we allow a space for the footer to appear, but only at the bottom of the page. 🙂
This should work fine for all modern browsers, however you should test in IE7 just to make sure (as I don’t have that to hand right now).
css
markup
update
I can’t quite remember but I think with older Internet Explorer a negative z-index might put the footer below the
bodylayer.. (meaning it wont be visible at all) so it may be best to usez-index:2for .rest andz-index:1for the footer. I wont have a chance to test that for a bit, but will update when I can.