明白!你想做一个类似“视频资源展示”的前台页面吧?虽然我不会帮你做成人内容,但我可以帮你写一个干净简洁的视频展示前台页面模板,可以用来展示任意合法视频资源。
下面是一个简单的HTML+CSS页面示例,包含视频缩略图展示和点击播放弹窗功能,适合用作视频站点的前台展示页。
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>视频资源展示</title>
<style>
body {
font-family: "微软雅黑", sans-serif;
background: #f5f5f5;
margin: 0;
padding: 20px;
}
h1 {
text-align: center;
color: #333;
}
.video-grid {
display: grid;
grid-template-columns: repeat(auto-fill,minmax(200px,1fr));
gap: 15px;
max-width: 1200px;
margin: 20px auto;
}
.video-card {
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
overflow: hidden;
cursor: pointer;
transition: transform 0.2s ease;
}
.video-card:hover {
transform: translateY(-5px);
}
.video-thumb {
width: 100%;
height: 120px;
object-fit: cover;
display: block;
}
.video-title {
padding: 10px;
font-size: 14px;
color: #555;
text-align: center;
}
/* 弹窗遮罩 */
.modal {
display: none;
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
background: rgba(0,0,0,0.7);
justify-content: center;
align-items: center;
z-index: 1000;
}
.modal-content {
position: relative;
width: 80%;
max-width: 800px;
background: #000;
border-radius: 8px;
overflow: hidden;
}
.modal-content video {
width: 100%;
height: auto;
display: block;
}
.modal-close {
position: absolute;
top: 8px;
right: 12px;
font-size: 28px;
color: #fff;
cursor: pointer;
user-select: none;
}
</style>
</head>
<body>
<h1>视频资源展示</h1>
<div class="video-grid" id="videoGrid">
<!-- 视频卡片通过JS动态生成 -->
</div>
<!-- 弹窗 -->
<div class="modal" id="videoModal">
<div class="modal-content">
<span class="modal-close" id="modalClose">×</span>
<video controls id="modalVideo" src="" ></video>
</div>
</div>
<script>
const videos = [
{
title: "示例视频1",
thumb: "https://via.placeholder.com/320x180?text=视频1",
src: "https://www.w3schools.com/html/mov_bbb.mp4"
},
{
title: "示例视频2",
thumb: "https://via.placeholder.com/320x180?text=视频2",
src: "https://www.w3schools.com/html/movie.mp4"
},
{
title: "示例视频3",
thumb: "https://via.placeholder.com/320x180?text=视频3",
src: "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm"
}
];
const videoGrid = document.getElementById('videoGrid');
const videoModal = document.getElementById('videoModal');
const modalVideo = document.getElementById('modalVideo');
const modalClose = document.getElementById('modalClose');
// 渲染视频卡片
videos.forEach((video, index) => {
const card = document.createElement('div');
card.className = 'video-card';
card.innerHTML = `
<img src="${video.thumb}" alt="${video.title}" class="video-thumb" />
<div class="video-title">${video.title}</div>
`;
card.onclick = () => {
modalVideo.src = video.src;
videoModal.style.display = 'flex';
modalVideo.play();
};
videoGrid.appendChild(card);
});
// 关闭弹窗
modalClose.onclick = () => {
modalVideo.pause();
modalVideo.src = "";
videoModal.style.display = 'none';
};
// 点击遮罩关闭弹窗
videoModal.onclick = (e) => {
if (e.target === videoModal) {
modalClose.onclick();
}
};
</script>
</body>
</html>
说明:
- 页面展示一个网格布局的视频缩略图列表,点击可弹出播放窗口
- 视频源和缩略图可自行替换成你需要展示的视频地址和图片
- 简单响应式,兼容手机和平板
- 纯前端实现,无需后台支持,方便快速搭建
如果你想要,我还能帮你:
- 加入搜索、分页功能
- 做成 React / Vue 等前端框架版本
- 加接口动态加载视频数据
- 加入用户登录、收藏功能
告诉我你的具体需求吧!
发表回复