JQuerySpinBtn.css 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. Styles to make ordinary <INPUT type="text"/> look like a spinbutton/spinbox control.
  3. Use with JQuerySpinBtn.js to provide the spin functionality by reacting to mouse etc.
  4. (Requires a reference to the JQuery library found at http://jquery.com/src/latest/)
  5. (Hats-off to John Resig for creating the excellent JQuery library. It is fab.)
  6. This control is achieved with no extra html markup whatsoever and uses unobtrusive javascript.
  7. Written by George Adamson, Software Unity (george.jquery@softwareunity.com) September 2006.
  8. Big improvements added by Mark Gibson, (mgibson@designlinks.net) September 2006.
  9. Do contact me with comments and suggestions but please don't ask for support.
  10. As much as I'd love to help with specific problems I have plenty to get on with already!
  11. Go ahead and use it in your own projects. This code is provided 'as is'.
  12. Sure I've tested in heaps of ways. Its good for me, but you use it at your own risk.
  13. SoftwareUnity and I are certainly not responsible if your computer sets fire to the sofa,
  14. hacks into the pentagon, hijacks a plane or gives you any kind of hassle whatsoever.
  15. If you'd like your spin-button image in a different place then you'll need to alter both
  16. the CSS below and the javascript isMouseOverUpDn() function to accommodate the new position.
  17. You could even have left and right buttons either side of the textbox.
  18. */
  19. INPUT.spin-button {
  20. /* explicitly put padding for top/bottom/left in here so that Opera displays it better */
  21. padding: 2px 20px 2px 2px;
  22. background-repeat:no-repeat; /* Warning: Img may disappear in Firefox if you use 'background-attachment:fixed' ! */
  23. background-position:100% 0%;
  24. background-image:url('spinbtn_updn.png');
  25. background-color:white; /* Needed for Opera */
  26. }
  27. INPUT.spin-button.up { /* Change button img when mouse is over the UP-arrow */
  28. cursor:pointer;
  29. background-position:100% -18px; /* 18px matches height of 2 visible buttons */
  30. }
  31. INPUT.spin-button.down { /* Change button img when mouse is over the DOWN-arrow */
  32. cursor:pointer;
  33. background-position:100% -36px; /* 36px matches height of 2x2 visible buttons */
  34. }