Nessuna descrizione

arrow.html 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <!DOCTYPE html> <title>Basic Visual Test</title>
  2. <style>
  3. @import '/reset.css';
  4. body {
  5. margin: 0;
  6. }
  7. #scroll {
  8. overflow: scroll;
  9. width: 584px;
  10. height: 584px;
  11. background-color: grey;
  12. }
  13. #scroll::before {
  14. content: 'before';
  15. display: block;
  16. height: 584px;
  17. width: 1px;
  18. }
  19. #scroll::after {
  20. content: 'after';
  21. display: block;
  22. height: 584px;
  23. width: 1px;
  24. }
  25. #reference {
  26. width: 200px;
  27. height: 200px;
  28. background-color: red;
  29. box-shadow: inset 0 0 0 1px black;
  30. }
  31. #popper {
  32. width: 100px;
  33. height: 100px;
  34. background-color: rebeccapurple;
  35. box-shadow: inset 0 0 0 1px black;
  36. }
  37. #arrow {
  38. width: 20px;
  39. height: 20px;
  40. background-color: yellow;
  41. }
  42. </style>
  43. <div id="scroll">
  44. <div id="reference"></div>
  45. </div>
  46. <div id="popper">
  47. Popper Box
  48. <div id="arrow" data-popper-arrow></div>
  49. </div>
  50. <script type="module">
  51. import { createPopper } from '../../dist/popper.js';
  52. const reference = document.querySelector('#reference');
  53. const popper = document.querySelector('#popper');
  54. window.instance = createPopper(reference, popper, {
  55. placement: 'right',
  56. modifiers: [
  57. {
  58. name: 'arrow',
  59. options: {
  60. padding: {
  61. top: 10,
  62. bottom: 20,
  63. },
  64. },
  65. },
  66. ],
  67. });
  68. </script>