CoffeeScript jQuery Animated Scrolling Sidebar
I have been really getting into writing CoffeeScript lately, so I decided to revisit the jQuery floating sidebar I blogged about a while back. The logic is the same, other than using a named function to increase readability. The code is shrunk from 40 lines to 28 lines (with extra line breaks for readability). More importantly, I believe the code is easier to understand.
The basic concept is to create function which I have called jitteryScroll that either scrolls the sidebar items, or returns them to the header if the scroll is at the top of the page. Then I define a function that fires on scroll and I use setTimeout in order to prevent the scroll function from overloading the browser (the scroll function fires like a machine gun when a user scrolls a page).
Let me know if you have any questions or suggestions.

Comments
Mrinal (not verified)
Tue, 09/11/2012 - 09:01
Permalink
You are amazing Ross. This
You are amazing Ross. This sidebar totally mesmerized me. I am very pity on people who use plugins for such thing and don't have time to come here, learn and write some comments for this amazing work. I work in Wordpress. I will try to make it happen there and will tell you.
Add new comment