willchange-containing-block.html 772 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <!DOCTYPE HTML>
  2. <html>
  3. <body>
  4. <style>
  5. body {
  6. padding: 100px;
  7. width: 5000px;
  8. height: 5000px;
  9. overflow: scroll;
  10. }
  11. div {
  12. }
  13. #parent {
  14. background:red;
  15. width: 64px;
  16. height: 64px;
  17. }
  18. #child {
  19. background:green;
  20. position:fixed;
  21. width: 32px;
  22. height: 32px;
  23. }
  24. </style>
  25. <div id="parent">
  26. <div id="child">
  27. </div>
  28. </div>
  29. <script type="application/javascript">
  30. if (document.location.search == '?willchange') {
  31. document.getElementById("parent").style.willChange = "transform";
  32. } else if (document.location.search == '?ref') {
  33. document.getElementById("parent").style.transform = "translateZ(1px)";
  34. } else if (document.location.search == '?noblock') {
  35. }
  36. document.documentElement.scrollTop = 10;
  37. document.documentElement.scrollLeft = 10;
  38. </script>
  39. </body>
  40. </html>