js+css实现带点击放大的懒数据加载图片瀑布流相册代码
代码语言:html
所属分类:瀑布流
代码描述:js+css实现带点击放大的懒数据加载图片瀑布流相册代码,可自定义列数,间距,布局方式,数据滚动到底部自动ajax加载请求新的数据放在后面。
代码标签: js css 点击 放大 懒数据 加载 图片 瀑布流 相册 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamic Waterfall Grid</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.header {
text-align: center;
color: white;
margin-bottom: 30px;
}
.header h1 {
font-size: 2.5rem;
margin-bottom: 10px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}
.controls {
display: flex;
justify-content: center;
gap: 15px;
flex-wrap: wrap;
margin-bottom: 20px;
}
.control-group {
background: rgba(255, 255, 255, 0.2);
padding: 10px 20px;
border-radius: 25px;
backdrop-filter: blur(10px);
display: flex;
align-items: center;
gap: 10px;
color: white;
}
.control-group label {
font-weight: 600;
}
.control-group select,
.control-group input {
padding: 5px 10px;
border-radius: 5px;
border: none;
background: white;
cursor: pointer;
}
button {
background: rgba(255, 255, 255, 0.3);
border: 2px solid white;
color: white;
padding: 10px 20px;
border-radius: 25px;
cursor: pointer;
font-weight: 600;
transition: all 0.3s ease;
}
button:hover {
background: white;
color: #667eea;
transform: translateY(-2px);
}
.stats {
text-align: center;
color: white;
margin-bottom: 20px;
font-size: 0.9rem;
display: flex;
justify-content: center;
gap: 20px;
flex-wrap: wrap;
}
.stat-item {
background: rgba(255, 255, 255, 0.2);
padding: 8px 16px;
border-radius: 20px;
backdrop-filter: blur(10px);
}
.waterfall-container {
position: relative;
width: 100%;
max-width: 1400px;
margin: 0 auto;
background: rgba(255, 255, 255, 0.1);
border-radius: 20px;
padding: 20px;
backdrop-filter: blur(10px);
min-height: 500px;
}
.waterfall-item {
position: absolute;
border-radius: 12px;
overflow: hidden;
background: white;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
transition: transform 0.3s ease, box-shadow 0.3s ease;
cursor: pointer;
opacity: 0;
animation: fadeIn 0.5s ease forwards;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: scale(0.9);
}
to {
opacity: 1;
transform: scale(1);
}
}
.waterfall-item:hover {
transform: translateY(-5px) scale(1.02);
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
z-index: 10;
}
.waterfall-item img {
width: 100%;
height: auto;
display: block;
object-fit: cover;
}
.waterfall-item .content {
padding: 15px;
}
.waterfall-item .title {
font-size: 1.1rem;
font-weight: 600;
margin-bottom: 8px;
color: #333;
}
.waterfall-item .description {
font-size: 0.9rem;
color: #666;
line-height: 1.5;
}
.waterfall-item .meta {
display: flex;
justify-content: space-between;
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid #eee;
font-size: 0.8rem;
color: #999;
}
.waterfall-item .category {
display: inline-block;
padding: 4px 12px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 600;
margin-bottom: 8px;
}
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0