On Making Web Things

jQuery Waypoints

02 March 2011

Last week I pushed a lit­tle jQuery plu­gin to GitHub called jQuery Way­points that gives devel­op­ers an easy hook into fir­ing a func­tion when users scroll to any given ele­ment. Thanks to some love from the Forrst com­mu­nity and a brief stint in the Top 10 on Hacker News, it’s gained the atten­tion of a few eyes. I’m just glad that some­body found it use­ful. Now that I’ve had a chance to process the imme­di­ate feed­back and fix a bug or two, I’d like to look back on what I learned.


Way­points started as a scrappy MooTools class that I wrote for a friend to use in one of his projects. The code, aside from being a lit­tle gross, had the sole pur­pose of snap­ping the user’s scroll posi­tion to the top of a sec­tion when the user scrolled close enough to it. I still don’t feel com­fort­able inter­rupt­ing a user’s nat­ural scroll to force them to a dif­fer­ent one, but the con­cept of using scroll prox­im­ity stuck with me.

Prior Art

Remy Sharp’s inview plu­gin is another great way to tie user scrolling to events, but only con­cerns itself with two ele­ment posi­tions: enter­ing and leav­ing the view­port. If those are the only ele­ment posi­tions you want to deal with, I still think inview is a supe­rior plugin.

GitHub = Pleasure

This was my first real open source pub­lic project. A lot of my career agency work has been for large clients that I prob­a­bly can’t even name under NDA. And my one other pub­lic repos­i­tory is a MooTools port of some­body else’s orig­i­nal work.

Git Immer­sion is a great resource for any­one look­ing to get started using Git seri­ously. Any­one who has ever taken the dive will tell you: there’s no going back. Once you’re com­fort­able with mov­ing between branches, com­mit­ting, and push­ing, GitHub Pages are cake and a nat­ural place for project pages to live.

Doc­u­men­ta­tion = Important

Con­sid­er­ing I was 8800 miles away, I didn’t actu­ally see it, but Kyle Neath’s Doc­u­men­ta­tion is freak­ing awe­some deck really kicked me into giv­ing a much bet­ter project doc­u­men­ta­tion expe­ri­ence than I might have oth­er­wise. I prob­a­bly spent as much time tweak­ing the word­ing and appear­ance of the docs as I did writ­ing the plu­gin. Not only does it reduce fric­tion for the devel­oper try­ing to use Way­points, it reduces fric­tion for me in try­ing to answer ques­tions and sup­port it.

The Future

With the most recent release, I’ve fin­ished adding core func­tion­al­ity. Writ­ing unit tests, fix­ing bugs as they come in, and expand­ing the plat­forms the plu­gin cov­ers will be the main focus in the near future. Way­points does what it does well enough and I’d pre­fer to keep it light. I’ll be inter­ested to see if any­one uses it as a brick to build some­thing neat. If you use Way­points and would like to share with me how you’re using it, give me a shout.