原生js实现电商购物车滚动粘性浮动效果代码
代码语言:html
所属分类:电商
代码描述:原生js实现电商购物车滚动粘性浮动效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/reset.min.css">
<style>
html {
--space: 2rem;
--space-xs: calc(var(--space) / 3);
--space-sm: calc(var(--space) / 2);
--space-md: calc(var(--space) * 2);
--color-primary: lightgray;
--color-accent: whitesmoke;
--color-dark: black;
--color-mid: gray;
--color-light: white;
--color-highlight: dodgerblue;
--radius: 0.125rem;
}
/* Here are the base styles for the main layout and sticky component */
* {
box-sizing: border-box;
}
main {
display: flex;
flex-wrap: wrap;
}
.article {
flex-basis: 0;
flex-grow: 999;
min-width: 40%;
}
.sidebar {
--offset: var(--space);
flex-grow: 1;
flex-basis: 300px;
align-self: start;
position: -webkit-sticky;
position: sticky;
top: var(--offset);
}
.component {
display: grid;
grid-template-rows: auto 1fr auto;
}
.component .content {
max-height: 500px;
overflow-y: auto;
}
.sidebar .component {
max-height: calc(100vh - var(--offset) * 2);
}
/*
* Other styles
**/
.visually-hidden {
clip: rect(0 0 0 0);
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
positi.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0