index.html 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1.0">
  6. <title>pbl-student</title>
  7. <style>
  8. @charset "utf-8";
  9. div::-webkit-scrollbar {
  10. /*滚动条整体样式*/
  11. width: 6px;
  12. /*高宽分别对应横竖滚动条的尺寸*/
  13. height: 6px;
  14. }
  15. /*定义滚动条轨道 内阴影+圆角*/
  16. div::-webkit-scrollbar-track {
  17. border-radius: 10px;
  18. background-color: rgba(0, 0, 0, 0.1);
  19. }
  20. /*定义滑块 内阴影+圆角*/
  21. div::-webkit-scrollbar-thumb {
  22. border-radius: 10px;
  23. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
  24. background-color: rgba(0, 0, 0, 0.1);
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <div id="app"></div>
  30. <!-- built files will be auto injected -->
  31. </body>
  32. </html>
  33. <script>
  34. function stopSafari() {
  35. //阻止safari浏览器双击放大功能
  36. let lastTouchEnd = 0 //更新手指弹起的时间
  37. document.documentElement.addEventListener("touchstart", function (event) {
  38. //多根手指同时按下屏幕,禁止默认行为
  39. if (event.touches.length > 1) {
  40. event.preventDefault();
  41. }
  42. });
  43. document.documentElement.addEventListener("touchend", function (event) {
  44. let now = (new Date()).getTime();
  45. if (now - lastTouchEnd <= 300) {
  46. //当两次手指弹起的时间小于300毫秒,认为双击屏幕行为
  47. event.preventDefault();
  48. } else { // 否则重新手指弹起的时间
  49. lastTouchEnd = now;
  50. }
  51. }, false);
  52. //阻止双指放大页面
  53. document.documentElement.addEventListener("gesturestart", function (event) {
  54. event.preventDefault();
  55. });
  56. }
  57. window.onload = () => {
  58. stopSafari();
  59. }
  60. document.domain = "cocorobo.cn"
  61. </script>