O'Reilly logo

jQuery UI Cookbook by Adam Boduch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Specifying the spin overflow

The spinner widget will happily let the user spin, indefinitely. It'll even change the display to use exponential notation when the JavaScript integer limit is reached, that's fine. Almost no application needs to worry about these limits. And in fact, it's probably best to put some limitations in place that actually make sense for the application. That is, specify a min boundary and a max boundary.

This works well, but it could work even better if we plug some logic into the spinner that handles overflow, when the user wants to go beyond the boundary. Rather than just stop spinning as is the default behavior, we just send them in the same direction, but starting from the opposite boundary. The best way to picture these ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required