nested-native-scroll.html 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link href="../css/perfect-scrollbar.css" rel="stylesheet">
  5. <script src="../dist/perfect-scrollbar.js"></script>
  6. <style>
  7. #container {
  8. position: relative;
  9. margin: 0px auto;
  10. padding: 0px;
  11. width: 600px;
  12. height: 400px;
  13. overflow: auto;
  14. }
  15. #container .content {
  16. background-image: url('./assets/azusa.jpg');
  17. width: 1280px;
  18. height: 720px;
  19. }
  20. .my-list, textarea {
  21. position: absolute;
  22. top: 0;
  23. left: 0;
  24. width: 130px;
  25. height: 200px;
  26. overflow: scroll;
  27. background-color: white;
  28. }
  29. ul {
  30. margin: 0;
  31. padding: 0;
  32. }
  33. li {
  34. box-sizing: border-box;
  35. padding: 10px 5px;
  36. border-width: 0 0 1px 0;
  37. list-style-type: none;
  38. margin: 0;
  39. }
  40. li:nth-child(even) {
  41. background-color: rgba(0,0,0,0.5);
  42. }
  43. </style>
  44. </head>
  45. <body>
  46. <div id="container">
  47. <div class="content">
  48. <textarea cols="20" rows="50" style="font-size: 120%">
  49. Children inside perfect scrollbar can be natively scrolled by the
  50. mousewheel. It automatically works for textarea elements, other
  51. elements need the .ps-child class.
  52. </textarea>
  53. <div class="my-list" style="left: 140px">
  54. <code>overflow: scroll</code>
  55. <ul><li>One</li><li>Two</li><li>Three</li><li>Four</li><li>Five</li><li>Six</li><li>Seven</li><li>Eight</li></ul>
  56. </div>
  57. <div class="my-list" style="left: 280px; overflow: auto">
  58. <code>overflow: auto</code>
  59. <ul><li>One</li><li>Two</li><li>Three</li><li>Four</li><li>Five</li><li>Six</li><li>Seven</li><li>Eight</li></ul>
  60. </div>
  61. </div>
  62. </div>
  63. <script type="text/javascript">
  64. new PerfectScrollbar('#container');
  65. </script>
  66. </body>
  67. </html>