Mythical Fish
Mythical Fish

Reputation: 293

position:fixed but with margin?

I have some buttons which are fixed either side of my page, they work well however if the browser window is made smaller (or the user has a very small resolution), the buttons fall bellow the footer.

I've seen it done before, an element is fixed to the side of the page but when you scroll to the bottom they are pushed up do avoid overflow.

Maybe its more than CSS?

Many thanks,

Jake

Edit: For those interested here is an example of the solution: http://blog.echoenduring.com/wp-content/uploads/demos/echo_ContainedStickyScroll/

Upvotes: 0

Views: 191

Answers (2)

rjb
rjb

Reputation: 9106

The jQuery Plugin StickyScroll may be what you're looking for — a jQuery plugin for creating elements that 'stick' to the top of the window when scrolling down the page.

Upvotes: 1

Fidi
Fidi

Reputation: 5834

try the following:

.button {
    position: fixed;
    bottom: 10px;
}

This would keep a button always 10px above the ground. If you want to dynamically slide up the button each time the user scrolls down with some nice effects, you will have to use javascript.

Upvotes: 0

Related Questions