Live data from Hacker News

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

webpop.github.com

31–38 of 38 posts

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

#31

Is there something like this that works properly in the mobile browser?

I have had reports that https://github.com/bigspotteddog/ScrollToFixed runs on mobile. Here are the confirmed combos:

- iPad 4 running iOS 6.0 (10A403) with dontCheckForPositionFixedSupport: true

- iPad 4 running iOS 6.0.1 (10A523)

- iPad 1 running iOS 5.1.1 (9B206) with dontCheckForPositionFixedSupport: true

- Nexus 7 running Android 4.2.1 with dontCheckForPositionFixedSupport: true

Unfortunately, I am mobile challenged so I cannot test these out for myself.

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

#32
post #20
post #18

Earlier quoted context omitted.

I don't think that's what he's addressing, though. It's this: var foo = function() { redeclaration(); } that I believe he's referring to, unless I'm mistaken.

I don't believe so. It sounds like he prefers using function declations to function expressions. And this is incorrect according to most js gurus. For example: http://javascriptweblog.wordpress.com/2010/07/06/function-de... From that link: "b) Function Expressions are more versatile. A Function Declaration can only exist as a “statement” in isolation. All it can do is create an object variable parented by its current…

He included far more code than was necessary, if that's the case. I don't see why the implementation of the function expression would be relevant if so. Clarity would help here.

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

#33
This and all other solutions on this page doesn't work, when sticky block height is more than window height. Always showed the top of the block, but it should be scrolled to the bottom, when you are scrolling content, in other way to see the bottom is possible only in case when page scroll to the bottom or container where this sticky block is embedded is over.

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

#34
As a best-practices criticism, this is using a direct window scroll handler, which can be a bit of a performance nightmare. It's often better to use some sort of throttling to make sure your scroll handler only runs every X ms. The tradeoff there, of course, is that you get a slightly less buttery-smooth pinning experience... but in return your pages will still scroll nicely on non-zippy machines.

Resig wrote about this after it horribly mauled Twitter a few years back: http://ejohn.org/blog/learning-from-twitter/

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

#35
post #9

I built something like this about a year ago called sticky-panel. https://code.google.com/p/sticky-panel/ Mine only has a couple added features like before and after detach events and support for overflow divs.

Do you have a demo for it somewhere?

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

#36
post #17

Earlier quoted context omitted.

That's definitely not in javascript the good parts. It's a new thing and its spreading like some sort of horrible virus. It has quite the opposite effect that you're prescribing to it. Your second link describes both variable hoisting, a real problem which causes serious problems, and function hoisting that has never been a problem as almost every other modern language behaves that way. You don't seem to be a polyglo…

I'm probably not the best person to have a debate about this since I don't have a traditional CS background. I dabble in many different languages, but I'll never claim to be an expert in any. To your point about this not being in the book JavaScript the Good Parts, I re-downloaded my purchase from Oreilly to double check, and throughout the book, all functions are declared as variables. Here's a screenshot from the s…

You're quite right. Bizarre that it didn't even register. At least that explains why some people have picked up that habit.

Crockford himself seems to have abandoned the habit if you check his github code.

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

#37
post #29

Earlier quoted context omitted.

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.

Wait, I don't think that JavaScript is homogeneous, not in the least, for me it's really heterogeneous, I can look at 3 or 4 scripts developed by people of different skills and backgrounds and see it done in 3 or 4 completely different styles, visually and syntactically. Did you messed up the wording over homogeneity?

I mean the syntax is homogeneous, I agree the styles in use today certainly aren't!

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

#38
post #9

I built something like this about a year ago called sticky-panel. https://code.google.com/p/sticky-panel/ Mine only has a couple added features like before and after detach events and support for overflow divs.

Do you have a demo for it somewhere?

http://sticky-panel.googlecode.com/svn/trunk/jquery.stickyPa...
Post reply on HN