csscursors.html 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <html>
  2. <head>
  3. <title>CSS cursors test</title>
  4. <style type="text/css">
  5. ul.cursor-demo {
  6. width: 50%;
  7. }
  8. ul.cursor-demo li {
  9. margin: 5px;
  10. padding: 10px 15px;
  11. border: 1px black solid;
  12. list-style-type: none;
  13. }
  14. #position {
  15. cursor: inherit;
  16. position: absolute;
  17. z-index: -1;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <h1>CSS cursors test</h1>
  23. <p>
  24. Hover over the CSS cursor name to see your browser's cursor style and where the HOTSPOT is.
  25. </p>
  26. <ul class="cursor-demo">
  27. <li style="cursor: default">default</li>
  28. <li style="cursor: crosshair">crosshair</li>
  29. <li style="cursor: hand">hand</li>
  30. <li style="cursor: pointer">pointer</li>
  31. <li style="cursor: not-allowed">not-allowed</li>
  32. <li style="cursor: move">move</li>
  33. <li style="cursor: text">text</li>
  34. <li style="cursor: vertical-text">vertical-text</li>
  35. <li style="cursor: wait">wait</li>
  36. <li style="cursor: progress">progress</li>
  37. <li style="cursor: help">help</li>
  38. <li style="cursor: no-drop">no-drop</li>
  39. <li style="cursor: n-resize">n-resize</li>
  40. <li style="cursor: ne-resize">ne-resize</li>
  41. <li style="cursor: e-resize">e-resize</li>
  42. <li style="cursor: se-resize">se-resize</li>
  43. <li style="cursor: s-resize">s-resize</li>
  44. <li style="cursor: sw-resize">sw-resize</li>
  45. <li style="cursor: w-resize">w-resize</li>
  46. <li style="cursor: nw-resize">nw-resize</li>
  47. <li style="cursor: all-scroll">all-scroll</li>
  48. <li style="cursor: col-resize">col-resize</li>
  49. <li style="cursor: row-resize">row-resize</li>
  50. </ul>
  51. <img id="position" src="positionmarker.png">
  52. <script type="text/javascript">
  53. (function() {
  54. var tracker = document.getElementById('position');
  55. document.onmousemove = handleMouseMove;
  56. function handleMouseMove(event) {
  57. var dot, eventDoc, doc, body, pageX, pageY;
  58. event = event || window.event; // IE-ism
  59. // If pageX/Y aren't available and clientX/Y are,
  60. // calculate pageX/Y - logic taken from jQuery.
  61. // (This is to support old IE)
  62. if (event.pageX == null && event.clientX != null) {
  63. eventDoc = (event.target && event.target.ownerDocument) || document;
  64. doc = eventDoc.documentElement;
  65. body = eventDoc.body;
  66. event.pageX = event.clientX +
  67. (doc && doc.scrollLeft || body && body.scrollLeft || 0) -
  68. (doc && doc.clientLeft || body && body.clientLeft || 0);
  69. event.pageY = event.clientY +
  70. (doc && doc.scrollTop || body && body.scrollTop || 0) -
  71. (doc && doc.clientTop || body && body.clientTop || 0 );
  72. }
  73. // Use event.pageX / event.pageY here
  74. tracker.style.top = event.pageY;
  75. tracker.style.left = event.pageX;
  76. }
  77. })();
  78. </script>
  79. </body>