Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A jQuery plugin to fix elements on a page when a user scrolls past them.
Tree: 5900deaa5c

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


This is a jQuery plugin I made to generically fix elements on a page when a user would scroll past them. The elements stay fixed in the browser window until the user scrolls back to up to where the element was at which point the element sticks back to its original position.

View a demo here.




floatScroll() takes an optional hash of options. There are 3 options available:

  • positionTop: defaulted to 0. Sets how far from the top of the browser window the elements should float.
  • placeholderClass: defaulted to 'scrollPlaceholder'. The class of the placeholder element injected into the DOM so the page doesn't lose its fundamental layout.
  • zIndex: defaulted to 100000. Sets the CSS z-index of the elements when they are floated.


I have only tested this on jQuery 1.6.2. I'm assuming it will work on anything later than that, but I don't know about anything earlier.

I have tested using the built-in test cases on IE7, IE8, IE9, Firefox 7, and Chrome 14. This does not support IE6. If you find that any of the tests fail in a browser you think it should work in, please open up an issue on Github or better yet fix it yourself :)


This is actually a pretty complicated piece of functionality to do generically. As such, there are a bunch of bugs and possible features that I will probably not get to. Feel free to contribute :)

Something went wrong with that request. Please try again.