Live data from Hacker News

Show HN: jQuery.pin – a plugin for making stuff stick

webpop.github.com

1–10 of 38 posts

Re: Show HN: jQuery.pin – a plugin for making stuff stick

#3
Could do with some smoothing and polishing. Jerks all over the place.

Also, what is with this new fashion of declaring functions as anonymous methods?

    var recalculateLimits = function () { 
       /* snip */
    }; 
    var update = function () { recalculateLimits(); onScroll(); };
Have I missed a memo?

EDIT: I forgot to say apart from my moaning, does the job, good code, good job! And it's only jerky when you use the scroll button on a mouse.

Re: Show HN: jQuery.pin – a plugin for making stuff stick

#4

Could do with some smoothing and polishing. Jerks all over the place. Also, what is with this new fashion of declaring functions as anonymous methods? var recalculateLimits = function () { /* snip */ }; var update = function () { recalculateLimits(); onScroll(); }; Have I missed a memo? EDIT: I forgot to say apart from my moaning, does the job, good code, good job! And it's only jerky when you use the scroll button o…

This [0] is the only difference I am aware of. But I would love to hear someone talk about performance differences (if any).

[0]: http://stackoverflow.com/a/336868/712889

Re: Show HN: jQuery.pin – a plugin for making stuff stick

#5

How does this compare to say Bootstrap's affix plugin? I see that it supports a min-width property, but personally I'd rather deal with this myself via media queries (matchMedia API in JS) than have a limited option via the plugin.

The difference is being able to specify a containing element, so the pinned part gets unpinned once you scroll past the bottom of the container.

We first developed the plugin for the Webpop gallery page (http://www.webpop.com/gallery) to make the description next to each screenshot stick to the top while you were viewing that gallery entry.

Later we also used it for the pinned navigation in our documentation section to make sure it didn't stay fixed and overlapped the footer once you scroll down to the bottom of the page. As far as I know Bootstrap's affix doesn't really help you there.

Re: Show HN: jQuery.pin – a plugin for making stuff stick

#7

Could do with some smoothing and polishing. Jerks all over the place. Also, what is with this new fashion of declaring functions as anonymous methods? var recalculateLimits = function () { /* snip */ }; var update = function () { recalculateLimits(); onScroll(); }; Have I missed a memo? EDIT: I forgot to say apart from my moaning, does the job, good code, good job! And it's only jerky when you use the scroll button o…

This [0] is the only difference I am aware of. But I would love to hear someone talk about performance differences (if any). [0]: http://stackoverflow.com/a/336868/712889

I actually got in an argument with someone on SO the other day who swore blind that the only was to declare a 'class' was using this pattern. Took a fiddle to shut him up.

I just don't get what it adds to your code apart from hiding simple function definitions in the visual trappings of a static helper object or closure. Javascript is already homogeneous enough without making it visually even more.

Post reply on HN