HTML纯代码给网页右下角增加弹窗视频代码(视频外链可自行准备也可使用随机视频API)
HTML代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
/* 设置提醒框的整体样式 */
.notification {
position: fixed;
bottom: 20px;
right: 20px;
background-color: #f8f9fa;
padding: 16px;
border: 1px solid #ccc;
border-radius: 4px;
}
/* 设置图片样式 */
.notification img {
width: 40px;
height: 40px;
margin-right: 16px;
}
/* 设置文字样式 */
.notification p {
color: #444;
line-height: 24px;
}
/* 设置关闭按钮的样式 */
.notification .closeButton {
position: absolute;
top: 0;
right: 0;
padding: 8px 12px;
background-color: #ccc;
color: #fff;
cursor: pointer;
}
</style>
</head>
<body>
<!-- 提醒框内容 -->
<div class="notification">
<video class="video" style="height:200px;width:136px;" src="https://api.woeo.net/API/api-girl/index.php" controls autoplay></video>
<p></p>
<!-- 关闭按钮 -->
<button class="closeButton">×</button>
</div>
<script>
// 获取提醒框的 DOM 元素
const notification = document.querySelector('.notification');
// 获取关闭按钮的 DOM 元素
const closeButton = document.querySelector('.notification .closeButton');
// 添加点击事件监听器
closeButton.addEventListener('click', () => {
// 隐藏提醒框
notification.style.display = 'none';
});
</script>
</body>
</html>