This commit is contained in:
杜恒
2021-01-20 16:14:48 +08:00
parent d9e7ec858d
commit b835bca92d
6 changed files with 74 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@@ -502,6 +502,69 @@
text-align: center;
color: var(--routine);
}
.item {
margin-bottom: 15px;
&:last-child {
margin-bottom: 0;
}
&:nth-child(1) .link .sort {
background: #ff183e;
}
&:nth-child(2).link .sort {
background: #ff5c38;
}
&:nth-child(3) .link .sort {
background: #ffb821;
}
.link {
position: relative;
display: block;
border-radius: 4px;
overflow: hidden;
&:hover .image {
transform: scale(1.2);
}
.sort {
position: absolute;
top: 5px;
right: -20px;
background: #7f7f8c;
color: #fff;
width: 65px;
text-align: center;
font-size: 12px;
transform: rotate(45deg);
font-weight: 500;
z-index: 1;
font-style: normal;
}
.image {
width: 100%;
height: 130px;
object-fit: cover;
transition: transform 0.35s;
}
.describe {
position: absolute;
z-index: 1;
left: 0;
right: 0;
bottom: 0;
padding: 10px;
background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.45));
font-size: 12px;
color: var(--seat);
h6 {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #fff;
line-height: 24px;
font-size: 14px;
}
}
}
}
}
}
}

View File

@@ -0,0 +1 @@
class LazyLoad{constructor(t){this.imglist=Array.from($(t)),this.init()}canILoad(){let t=this.imglist;for(let i=t.length;i--;)this.getBound(t[i])&&this.loadImage(t[i],i)}getBound(t){let i=t.getBoundingClientRect(),n=window.innerHeight;return i.top<=n}loadImage(t,i){let n=t.getAttribute("data-original");t.src=n,this.imglist.splice(i,1)}bindEvent(){$(window).on("scroll",()=>this.imglist.length&&this.canILoad()),$(window).on("resize",()=>this.imglist.length&&this.canILoad())}init(){this.canILoad(),this.bindEvent()}}