lenis实现滚动商品卡片翻页显示购物车代码
代码语言:html
所属分类:电商
代码描述:lenis实现滚动商品卡片翻页显示购物车代码,滚动页面试试。
代码标签: lenis 滚动 商品 卡片 翻页 显示 购物车 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@import url(https://fonts.googleapis.com/css2?family=Montserrat:wght@100..900&display=swap);
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
}
body {
font-family: "Montserrat", sans-serif;
font-size: 1em;
min-height: 100vh;
overflow-x: hidden;
scroll-behavior: smooth;
background-color: #f8d30f;
}
.dynamic-header {
position: fixed;
top: 20px;
left: 20px;
z-index: 888;
display: flex;
flex-direction: column;
align-items: flex-end;
transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
pointer-events: none;
}
.shop-name {
font-family: "Montserrat", sans-serif;
font-size: clamp(32px, 8vw, 96px);
font-weight: 800;
background: linear-gradient(
135deg,
#1a1a1a,
#be1526,
#d4af37,
#be1526,
#1a1a1a
);
background-size: 400% 400%;
-webkit-background-clip: text;
background-clip: text;
color: #fff0;
animation: gradientShift 10s ease infinite;
padding: 15px 25px;
border-radius: 20px;
transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
white-space: nowrap;
pointer-events: auto;
line-height: 1.2;
text-align: center;
}
@keyframes gradientShift {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
.shop-name br {
display: block;
}
.dynamic-header.scrolled {
top: auto;
bottom: 20px;
left: 20px;
right: auto;
align-items: flex-start;
}
.dynamic-header.scrolled .shop-name {
font-size: 16px;
font-weight: 400;
padding: 10px 20px;
white-space: nowrap;
line-height: 1;
transform: translate(22px, -10px);
transform-origin: left top;
display: inline-block;
}
.dynamic-header.scrolled .shop-name br {
display: none;
}
.dynamic-header.scrolled .shop-name .shop-name-text {
font-size: 16px;
font-weight: 700;
}
.dynamic-header.scrolled .shop-name .shop-details-inline {
font-size: 12px;
font-weight: 400;
margin-left: 8px;
}
@media (max-width: 800px) {
.dynamic-header.scrolled .shop-name {
transform: rotate(-90deg) translate(15px, -30px);
padding: 8px 15px;
}
.dynamic-header.scrolled .shop-name .shop-name-text {
font-size: 14px;
color: #000;
}
.dynamic-header.scrolled .shop-name .shop-details-inline {
font-size: 10px;
color: #000;
}
}
.new-in-banner {
position: absolute;
z-index: 887;
background: #0a0a0a;
background-image: radial-gradient(
circle at 25% 40%,
rgb(212 175 55 / 0.15) 2%,
transparent 2.5%
),
radial-gradient(
circle at 75% 60%,
rgb(212 175 55 / 0.12) 1.8%,
transparent 2%
);
background-size: 40px 40px, 35px 35px;
color: #d4af37;
padding: 45px 70px;
border-radius: 32px;
text-align: center;
box-shadow: 0 30px 50px -20px rgb(0 0 0 / 0.8),
inset 0 1px 1px rgb(255 255 255 / 0.1);
border: 1px solid rgb(212 175 55 / 0.4);
backdrop-filter: blur(2px);
cursor: pointer;
transition: all 0.4s cubic-bezier(0.2, 0.9, 0.4, 1.1);
letter-spacing: 2px;
}
@media (min-width: 801px) {
.new-in-banner {
top: 65%;
left: 46%;
transform: translate(-50%, -50%) rotate(3deg);
padding: 30px 50px;
}
.new-in-banner:hover {
transform: translate(-50%, -50%) scale(1.02) rotate(-6deg);
box-shadow: 0 35px 55px -18px #000;
border-color: rgb(212 175 55 / 0.7);
background: #0c0b0b;
}
}
@media (max-width: 800px) {
.new-in-banner {
top: 60%;
left: 50%;
right: auto;
transform: none;
margin: 20px auto;
width: 90%;
max-width: 300px;
padding: 25px 40px;
transform: translateX(-50%) rotate(3deg);
}
.new-in-banner:hover {
transform: translateX(-50%) rotate(3deg) scale(1.02);
}
}
.new-in-banner h2 {
font-size: 3.8rem;
font-weight: 600;
letter-spacing: 8px;
margin-bottom: 18px;
text-transform: uppercase;
background: linear-gradient(135deg, #e4c580 0%, #b8912e 45%, #f3e5ab 100%);
-webkit-background-clip: text;
background-clip: text;
color: #fff0;
text-shadow: 0 2px 5px rgb(0 0 0 / 0.3);
font-family: "Montserrat", sans-serif;
}
@media (max-width: 800px) {
.new-in-banner h2 {
font-size: 2rem;
letter-spacing: 4px;
}
.new-in-banner .category-description {
font-size: 0.9rem;
}
}
@media (max-width: 480px) {
.new-in-banner h2 {
font-size: 1.6rem;
}
.new-in-banner {
padding: 20px 25px;
}
}
.new-in-banner .category-description {
font-size: 1.2rem;
font-weight: 400;
letter-spacing: 2px;
color: #c9aa4b;
border-top: 1px solid rgb(212 175 55 / 0.4);
display: inline-block;
padding-top: 12px;
text-transform: uppercase;
font-style: italic;
}
.new-in-banner::before {
content: "❦";
position: absolute;
top: -20px;
left: 50%;
transform: translateX(-50%);
font-size: 2rem;
color: #d4af37;
text-shadow: 0 0 6px rgb(0 0 0 / 0.5);
}
.new-in-banner::after {
content: "❦";
position: absolute;
bottom: -20px;
left: 50%;
transform: translateX(-50%);
font-size: 2rem;
color: #d4af37;
}
@keyframes subtleGlow {
0% {
text-shadow: 0 0 0 rgb(212 175 55 / 0.3);
border-color: rgb(212 175 55 / 0.4);
}
50% {
text-shadow: 0 0 5px rgb(212 175 55 / 0.6);
border-color: rgb(212 175 55 / 0.7);
}
100% {
text-shadow: 0 0 0 rgb(212 175 55 / 0.3);
border-color: rgb(212 175 55 / 0.4);
}
}
.new-in-banner {
animation: subtleGlow 3s infinite ease-in-out;
}
.cart-button {
position: fixed;
top: 20px;
right: 20px;
background-color: #be1526;
color: #fff;
border: none;
padding: 12px 20px;
border-radius: 30px;
cursor: pointer;
font-weight: 700;
font-size: 1rem;
z-index: 1000;
display: flex;
align-items: center;
gap: 10px;
box-shadow: 0 4px 15px rgb(0 0 0 / 0.2);
transition: transform 0.3s, background-color 0.3s;
}
.cart-button:hover {
background-color: #8f0f1c;
transform: scale(1.05);
}
.cart-count {
background-color: #fff;
color: #be1526;
border-radius: 50%;
width: 24px;
height: 24px;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 0.8rem;
font-weight: 700;
}
.cart-modal {
position: fixed;
top: 0;
right: -100%;
width: 100vw;
max-width: 400px;
height: 100vh;
background-color: #fff;
box-shadow: -2px 0 20px rgb(0 0 0 / 0.2);
z-index: 1001;
transition: right 0.3s ease;
display: flex;
flex-direction: column;
overflow: hidden;
}
.cart-modal.open {
right: 0;
}
.cart-header {
background-color: #be1526;
color: #fff;
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
flex-shrink: 0;
}
.cart-header h3 {
margin: 0;
}
.close-cart {
background: none;
border: none;
color: #fff;
font-size: 28px;
cursor: pointer;
font-weight: 700;
}
.close-cart:hover {
opacity: 0.8;
}
.cart-items {
flex: 1;
overflow-y: auto;
padding: 20px;
}
.cart-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 0;
border-bottom: 1px solid #eee;
}
.cart-item-info {
flex: 1;
}
.cart-item-title {
font-weight: 700;
margin-bottom: 5px;
}
.cart-item-details {
font-size: 0.85rem;
color: #666;
}
.cart-item-price {
font-weight: 700;
color: #be1526;
}
.cart-item-remove {
background: none;
border: none;
color: #999;
cursor: pointer;
font-size: 20px;
padding: 5px;
margin-left: 10px;
}
.cart-item-remove:hover {
color: #be1526;
}
.cart-footer {
padding: 20px;
border-top: 2px solid #eee;
background-color: #f9f9f9;
flex-shrink: 0;
}
.cart-total {
display: flex;
justify-content: space-between;
font-size: 1.2rem;
font-weight: 700;
margin-bottom: 15px;
}
.checkout-btn {
width: 100%;
background-color: #be1526;
color: #fff;
border: none;
padding: 12px;
border-radius: 25px;
cursor: pointer;
font-weight: 700;
font-size: 1rem;
transition: background-color 0.3s;
}
.checkout-btn:hover {
background-color: #8f0f1c;
}
.empty-cart {
text-align: center;
color: #999;
padding: 40px;
}
.overlay-.........完整代码请登录后点击上方下载按钮下载查看















网友评论0