You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fullHeightScrollbar.html 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5. <style type="text/css">
  6. .wrapper {
  7. height: 150px;
  8. width: 150px;
  9. border: 1px solid black;
  10. overflow: auto;
  11. position: relative;
  12. }
  13. .content {
  14. height: 100%;
  15. width: 250px;
  16. background: grey;
  17. }
  18. </style>
  19. <script type="text/javascript">
  20. function disableScrolling() {
  21. var result = document.getElementsByClassName("content");
  22. for(var i = 0; i < result.length; i++) {
  23. var e = result[i];
  24. e.style.width = "100%";
  25. }
  26. }
  27. function triggerReflow() {
  28. var style = "top";
  29. var styleValue = "1px";
  30. var result = document.getElementsByClassName("wrapper");
  31. for(var i = 0; i < result.length; i++) {
  32. var e = result[i];
  33. var originalValue = e.style[style];
  34. e.style[style] = styleValue;
  35. e.offsetWidth;
  36. e.style[style] = originalValue;
  37. }
  38. }
  39. </script>
  40. </head>
  41. <body scroll="auto">
  42. <p>This test is used to verify how browsers take horizontal scrollbars into account when calculating 100% height and what happens when scrolling is no longer needed. This test tells which browsers need which workarounds for related features.</p>
  43. <p>Basic situation.
  44. <div class="wrapper"><div class="content"></div></div>
  45. </p>
  46. <p>
  47. Situation with position: absolute on the inner element.
  48. <div class="wrapper"><div class="content" style="position: absolute"></div></div>
  49. </p>
  50. <button id="disableScrolling" onclick="disableScrolling()">Disable scrolling</button>
  51. <button id="triggerReflow" onclick="triggerReflow()">Trigger reflow</button>
  52. </body>
  53. </html>