人物图像拖动滚动效果

代码语言:html

所属分类:加载滚动

代码描述:人物图像拖动滚动效果

代码标签: 滚动 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<script>
      document.documentElement.className = "js";
      var supportsCssVars = function () {
        var e,
          t = document.createElement("style");
        return (
          (t.innerHTML = "root: { --tmp-var: bold; }"),
          document.head.appendChild(t),
          (e = !!(
            window.CSS &&
            window.CSS.supports &&
            window.CSS.supports("font-weight", "var(--tmp-var)")
          )),
          t.parentNode.removeChild(t),
          e
        );
      };
      supportsCssVars() ||
        alert(
          "Please view this demo in a modern browser that supports CSS Variables."
        );
    </script>
<style>
*,
*::after,
*::before {
  box-sizing: border-box;
}

:root {
  --search-box-height: 54px;
  --avatar-size: 44px;
  --bg-color: #d8d8d8;
  --color-white: #ffffff;
  --shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}

body {
  background: var(--bg-color);
}

.search-outer {
  max-width: 500px;
  height: var(--search-box-height);
  margin: 100px auto 0 auto;
  position: relative;
  overflow-x: hidden;
  background: #fff;
  box-shadow: var(--shadow);
  border-radius: var(--search-box-height);
}

.search-inner {
  position: relative;
  top: 0;
  height: 100%;
  width: -moz-fit-content;
  width: -webkit-fit-content;
  width: fit-content;
}

.avatars {
  width: -moz-fit-content;
  width: -webkit-fit-content;
  width: fit-content;
  height: 100%;
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  position: relative;
  pointer-events: none;
}

.avatar {
  margin: 0px 5px;
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: center;
          justify-content: center;
}

.avatar > img {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 100%;
  -o-object-fit: cover;
     object-fit: cover;
}

.draggable {
  height: var(--search-box-height);
  top: calc(50% - calc(var(--search-box-height) / 2));
  width: 100%;
  position: absolute;
  cursor: -webkit-grab;
  cursor: grab;
}

.draggable:active {
  cursor: -webkit-grabbing;
  cursor: grabbing;
}
</style>

</head>
<body translate="no">
<div class="search-outer">
<div class="search-inner">
<div class="draggable"></div>
<div class="avatars">
<figure class="avatar">
<img src="http://repo.bfw.wiki/bfwrepo/image/5e0c6f962a0d0.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_100,h_100,/quality,q_90" />
</figure>
<figure class="avatar">
<img src="http://repo.bfw.wiki/bfwrepo/image/5e0c6f962a0d0.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_100,h_100,/quality,q_90" />
</figure>
<figure class="avatar">
<img src="http://repo.bfw.wiki/bfwrepo/image/5e0c6f962a0d0.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_100,h_100,/quality,q_90" />
</figure>
<figure class="avatar">
<img src="http://repo.bfw.wiki/bfwrepo/image/5e0c6f962a0d0.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_100,h_100,/quality,q_90" />
</figure>
<figure class="avatar">
<img src="http://repo.bfw.wiki/bfwrepo/image/5e0c6f962a0d0.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_100,h_100,/quality,q_90" />
</figure>
<figure class="avatar">
<img src="http://repo.bfw.wiki/bfwrepo/image/5e0c6f962a0d0.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_100,h_100,/quality,q_90" />
</figure>
<figure class="avatar">
<img src="http://repo.bfw.wiki/bfwrepo/image/5e0c6f962a0d0.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_100,h_100,/quality,q_90" />
</figure>
<figure class="avatar">
<img sr.........完整代码请登录后点击上方下载按钮下载查看

网友评论0