下拉菜单选择动画交互效果

代码语言:html

所属分类:表单美化

代码描述:下拉菜单选择动画交互效果

代码标签: 交互 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link type="text/css" rel="stylesheet" href="http://repo.bfw.wiki/bfwrepo/css/reset.min.css">
<style>
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500&display=swap");
html {
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

html,
body {
  height: 100%;
  width: 100%;
}

body {
  background: #efeff0;
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 400;
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: center;
          justify-content: center;
}

.folder {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  width: 450px;
}

.shared-user {
  -webkit-box-align: center;
          align-items: center;
  color: #6a696a;
  display: -webkit-inline-box;
  display: inline-flex;
  font-weight: 500;
  margin-left: 5px;
  outline: none;
  text-decoration: none;
}
.shared-user__avatar {
  width: 15px;
  height: 15px;
  margin-right: 3px;
}

.folder-summary {
  padding: 15px 20px 15px 15px;
  cursor: pointer;
  display: -webkit-box;
  display: flex;
  line-height: 1;
  height: 80px;
  position: relative;
}
.folder-summary__start {
  position: relative;
}
.folder-summary__file-count {
  position: absolute;
  top: -3px;
}
.folder-summary__file-count__amount {
  color: #ffffff;
  font-size: 12px;
  left: 50%;
  position: absolute;
  top: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
}
.folder-summary__file-count svg {
  color: #5166fa;
  height: 30px;
  width: auto;
}
.folder-summary__details {
  padding: 2px 0 0 13px;
}
.folder-summary__details__name {
  color: #393738;
  font-size: 20px;
  font-weight: 500;
}
.folder-summary__details__share {
  -webkit-box-align: center;
          align-items: center;
  color: #b5b4b5;
  display: -webkit-box;
  display: flex;
  font-size: 15px;
  margin-top: 8px;
}
.folder-summary__end {
  margin-left: auto;
}
.folder-summary__end svg {
  fill: #c3c2c3;
}
.folder-summary::after {
  background: #e6e6e6;
  bottom: -2px;
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  right: 0;
}

.folder-collapse-button {
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  background: transparent;
  border-radius: 30px;
  border: 0;
  cursor: pointer;
  height: 30px;
  opacity: 0;
  outline: none;
  position: absolute;
  position: relative;
  width: 30px;
  z-index: 1;
}
.folder-collapse-button::after {
  background: #efeff0;
  border-radius: 40px;
  content: "";
  height: 35px;
  left: 50%;
  opacity: 0;
  position: absolute;
  top: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  -webkit-transition: all 0.2s ease-out;
  transition: all 0.2s ease-out;
  width: 35px;
}
.folder-collapse-button:hover::after {
  opacity: 1;
}
.folder-collapse-button svg {
  color: #9c9c9e;
  left: 50%;
  position: absolute;
  stroke-width: 3;
  top: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  z-index: 2;
}

.folder-item {
  -webkit-box-align: start;
          align-items: flex-start;
  display: -webkit-box;
  display: flex;
  height: 80px;
  line-height: 1;
  opacity: 0;
  padding: 20px 25px;
  position: relative;
}
.folder-item__icon svg {
  display: block;
  height: 40px;
  width: auto;
}
.folder-item__details {
  padding: 1px 0 0 15px;
}
.folder-item__details__name {
  color: #393738;
  font-size: 17px;
  font-weight: 500;
  position: relative;
}
.folder-item__details__name svg {
  height: auto;
  position: absolute;
  top: 50%;
  -webkit-transform: translate(5px, calc(-50% + 1px));
          transform: translate(5px, calc(-50% + 1px));
  width: 20px;
}
.folder-item__details__date {
  color: #b5b4b5;
  font-size: 15px;
  margin-top: 8px;
}
.folder-item__size {
  color: #6a696a;
  font-weight: 500;
  margin-left: auto;
  margin-top: 2px;
}
.folder-item:not(:last-child)::after {
  background: #edecee;
  bottom: 0;
  content: "";
  height: 1px;
  left: 80px;
  position: absolute;
  right: 0;
}
</style>

</head>
<body translate="no">


<div class="folder" id="js_folder">
<div class="folder-summary" id="js_toggle-folder">
<div class="folder-summary__start">
<button class="folder-collapse-button" id="js_folder-collapse-button">
<svg id="js_folder-collapse-button-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-up">
<polyline points="18 15 12 9 6 15"></polyline>
</svg>
</button>
<div class="folder-summary__file-count" id="js_folder-summary-amount">
<span class="folder-summary__file-count__amount">3</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-folder">
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path>
</svg>
</div>
</div>
<div class="folder-summary__details">
<div class="folder-summary__details__name">
Portfolio
</div>
<div class="folder-summary__details__share">
Design by
<a class="shared-user" href="https://dribbble.com/7ahang" target="_blank" rel="noopener noreferrer">
<svg class="shared-user__avatar" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="12" cy="12" r="12" fill="#1C213E" />
<circle cx="12" cy="12" fill="#BFBFC0" r="6.168" />
<circle cx="12.561" cy="11.439" r="5.607" fill="url(#paint0_radial)" fill-opacity=".5" />
<defs>
<radialGradient id="paint0_radial" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="rotate(109.486 3.244 10.282) scale(7.73263)">
<stop stop-color="#758EA9" />
<stop offset="1" stop-color="#668097" stop-opacity="0" />
</radialGradient>
</defs>
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0