CSS快捷的全屏和取消全屏

<style>
  .fullscreen {
    position: fixed!important;
    top: 0!important;
    left: 0!important;
    width: 100%!important;
    height: 100%!important;
    margin: 0!important;
    z-index: 100;
    background-color: aquamarine;
    border-radius: 50%;
    box-shadow:blueviolet;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .divStyle {
    width: 100px;
    height: 100px;
    background-color: aquamarine;
    border-radius: 50%;
    box-shadow:blueviolet;
    display: flex;
    align-items: center;
    justify-content: center;
  }
</style>
<body>
  <div class="divStyle" onclick="bigscreen()" id='cc'>123</div>
</body>
</html>
<script>
  function bigscreen() {
    const obj = document.getElementById('cc')
    obj.className = obj.className === 'fullscreen' ? 'divStyle' : 'fullscreen'
  }
</script>


//主要代码
.fullscreen {
    position: fixed!important;
    top: 0!important;
    left: 0!important;
    width: 100%!important;
    height: 100%!important;
    margin: 0!important;
    z-index: 100;
}
上一篇:简易版甘特图


下一篇:Android RecyclerView 列表加载图片宽高适配