options-default.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8">
  5. <title>perfect-scrollbar example</title>
  6. <link href="../dist/css/perfect-scrollbar.css" rel="stylesheet">
  7. <script src="../dist/js/perfect-scrollbar.js"></script>
  8. <style>
  9. .contentHolder { position:relative; margin:0px auto; padding:0px; width: 600px; height: 400px; overflow: auto; }
  10. .contentHolder .content { background-image: url('./azusa.jpg'); width: 1280px; height: 720px; }
  11. .spacer { text-align:center }
  12. </style>
  13. </head>
  14. <body>
  15. <div id="Default" class="contentHolder">
  16. <div class="content">
  17. </div>
  18. </div>
  19. <p style='text-align: center'>
  20. Width <input type='text' id='width' value='600'>
  21. Height <input type='text' id='height' value='400'>
  22. <button onclick='updateSize()'>Change!</button>
  23. </p>
  24. <script>
  25. var $ = document.querySelector.bind(document);
  26. window.onload = function () {
  27. Ps.initialize($('#Default'));
  28. };
  29. var updateSize = function () {
  30. var width = parseInt($('#width').value, 10);
  31. var height = parseInt($('#height').value, 10);
  32. var container = $('#Default');
  33. container.style.width = width + 'px';
  34. container.style.height = height + 'px';
  35. Ps.update(document.querySelector('#Default'));
  36. };
  37. </script>
  38. </body>
  39. </html>