Live data from Hacker News

Buttons with built-in loading indicators

lab.hakim.se

41–50 of 64 posts

Re: Buttons with built-in loading indicators

#41
post #40
post #6

It's not known very well, but Bootstrap has similar functionality, albeit not as pretty: http://twitter.github.io/bootstrap/javascript.html#buttons

I combined the bootstrap method with some Font-Awesome, and accomplished getting some animation in my buttons in a simple manner. See "Buttons" section at http://fortawesome.github.io/Font-Awesome/examples/

Font-Awesome also has a really nice 'Animated Spinner' icon as well on that example page, which works nicely with Bootstrap buttons.

Re: Buttons with built-in loading indicators

#42
What impresses me the most is the JS. It is so clean, concise, and, the only other word that I can think of, professional. It puts the onus of capability on the browser and doesn't try to make up for those who lack. Sure you can shim addEventListener or setAttribut, but F IE (really), it has been adding complexity for far too long.

Re: Buttons with built-in loading indicators

#43
post #19

On Firefox, a dotted line appears around the button's text when it has focus (after click for instance). IMO, it ruins the nice clear style of the buttons. You can remove it with the non-standard `button::-moz-focus-inner{border:0}`. Then you could define some style for `button:focus{...}` to help keyboard navigation.

Or just button:focus{ outline:none; }. That should remove focus styling on all browsers, last I checked.

Re: Buttons with built-in loading indicators

#44

What impresses me the most is the JS. It is so clean, concise, and, the only other word that I can think of, professional. It puts the onus of capability on the browser and doesn't try to make up for those who lack. Sure you can shim addEventListener or setAttribut, but F IE (really), it has been adding complexity for far too long.

Much easier to get away with when it's a small thing for developers. I'm guessing slid.es shows a little more deference to IE. Just a guess, though.

Re: Buttons with built-in loading indicators

#45

We did something similar on one of our office hack days. http://waitable.adstruc.com/ https://github.com/ADstruc/waitable We built a generic jQuery plugin which binds to jQuery promises, taking care of the waiting state and double-submit issues while firing off Ajax requests.

I like your implementation. The demos in TFA all seem like pretty bad UX to me.

Re: Buttons with built-in loading indicators

#46
post #6

It's not known very well, but Bootstrap has similar functionality, albeit not as pretty: http://twitter.github.io/bootstrap/javascript.html#buttons

That's actually the technique I use for buttons in my apps, and I believe I prompted them to add it to Bootstrap. You can see the thread about it here where it was added: https://github.com/twitter/bootstrap/issues/471#issuecomment... But my point isn't who-invented-it, it's that it's very easy to implement this in your own buttons without using Bootstrap. I still use my own implementation, despite suggesting it to t…

It's a great technique for buttons, even without the nice design. I've wondered for years why this is not more common. Having a "submit" button change state is such better UI than those horrid messages warning you not to click twice—I still run into that from time to time.

Re: Buttons with built-in loading indicators

#47
post #36
post #15

It's worth a note that these buttons are very laggy in MobileSafari, except for zoom-in and zoom-out, which use -webkit-transform and thus have hardware accelerated animation. While slide-* could be changed to use -webkit-transform, I'm somewhat surprised that the performance of the others is so bad, and I wonder if there's some not-completely-awful trick that would improve expand-*.

I actually was impressed by their smoothness on my 4S. What device are you using?

They were a little choppy on my iPad mini.

Re: Buttons with built-in loading indicators

#48

What impresses me the most is the JS. It is so clean, concise, and, the only other word that I can think of, professional. It puts the onus of capability on the browser and doesn't try to make up for those who lack. Sure you can shim addEventListener or setAttribut, but F IE (really), it has been adding complexity for far too long.

Thanks for pointing this out. Based on your comment I reviewed and the style is really nice. I haven't seen that method of returning the public API before but like you said, it is very clean.

Re: Buttons with built-in loading indicators

#49
Interesting use case, but not practical enough. All the times when you need to show a loading indicator do not occur after clicking on a button, loading indicator needs to come up when any amount of delay is anticipated. It can show up after clicking a link, image etc etc whereas this example implies as if loading indicator is only need when a button is clicked.

Re: Buttons with built-in loading indicators

#50
post #49

Interesting use case, but not practical enough. All the times when you need to show a loading indicator do not occur after clicking on a button, loading indicator needs to come up when any amount of delay is anticipated. It can show up after clicking a link, image etc etc whereas this example implies as if loading indicator is only need when a button is clicked.

I expect this is trying to solve problems like double form submission.
Post reply on HN