本文介绍: 效果如图:当浏览器滚轮在最上面的时候什么区别。当鼠标滚轮超出最上面高度时会有这种粒子感。首先要 明确 css 基础属性 position: sticky;

在这里插入图片描述

效果如图:当浏览器滚轮在最上面的时候什么区别。当鼠标滚轮超出最上面高度时会有这种粒子吸顶遮盖下面内容
在这里插入图片描述在这里插入图片描述

首先要 明确 css 基础属性 position: sticky;用法。再了解
background-image: radial-gradient(transparent 1px, #fff 1px);
background-size: 4px 4px;
backdrop-filter: saturate(50%) blur(4px);

vue 代码

<template>
  <div style="height: 500px; overflow: auto">
    <div class="top-div"&gt;
      <div&gt;
        xx
        <el-button type="info" size="mini"&gt;htllo</el-button&gt;
        xx
      </div&gt;
    </div>
    <div>
      <div v-for="item in indexArr" :key="item" style="margin-bottom: 5px">
        {{ item }}+j ioash haugh adhgajd faihdg ioahgaf nFN OIHG OIAHG IOAJSIO JO
        <el-button type="primary">xxasd sud</el-button>
        <el-tag type="warning">xxhasdhiuash </el-tag>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      indexArr: [],
    };
  },
  mounted() {
    setTimeout(() => {
      for (let i = 1; i <= 100; i++) {
        this.indexArr.push(i);
      }
    }, 1000);
  },
  methods: {},
};
</script>

<style lang='scss'>
.top-div {
  position: sticky;
  top: 0;
  left: 0;
  height: 55px;
  border-bottom: 1px solid #ccc;
  background-image: radial-gradient(transparent 1px, #fff 1px);
  background-size: 4px 4px;
  backdrop-filter: saturate(50%) blur(4px);
}
</style>

原文地址:https://blog.csdn.net/qq_37167049/article/details/133708383

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_40352.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注