代码
<!--LOGO变色-顾熙博客 blog.a686.de-->
<style>.navbar-logo{animation: hue 4s infinite;}@keyframes hue {from {filter: hue-rotate(0deg);}to {filter: hue-rotate(-360deg);}}</style>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>悬浮图片示例</title>
<style>
/* 默认样式,适用于所有设备 */
.floating-image {
display: none; /* 默认隐藏悬浮图片 */
}
.close-button {
/* 关闭按钮样式 */
position: absolute;
top: 5px;
right: 5px;
width: 30px;
height: 30px;
background-color: #f00;
border-radius: 50%;
text-align: center;
line-height: 30px;
color: #fff;
font-size: 18px;
cursor: pointer;
}
/* 媒体查询,针对桌面设备显示悬浮图片 */
@media screen and (min-width: 768px) { /* 以常见的平板横屏分辨率为分界点 */
.floating-image {
position: fixed;
right: 20px;
bottom: 20px;
z-index: 999;
display: block; /* 显示悬浮图片 */
}
}
</style>
</head>
<body>
<!-- 悬浮图片容器 -->
<div class="floating-image">
<!-- 图片 -->
<a class="float-btn pay-vip" target="_blank">
<img src="https://js.al886.cn/2024/07/20240709020603783.gif" alt="悬浮图片" style="width: 200px; height: auto;"> <!-- 调整宽度为200px,高度自动调整以保持比例 -->
<!-- 关闭按钮 -->
<div class="close-button" onclick="closeFloatingImage()">×</div> <!-- 点击关闭按钮隐藏悬浮图片 -->
</div>
<!-- JavaScript 用于隐藏悬浮图片 -->
<script>
function closeFloatingImage() {
document.querySelector('.floating-image').style.display = 'none'; //隐藏悬浮图片容器
}
</script>
</body>
</html>
将上述代码加入子比全局自定义底部HTML代码中即可
![图片[1]-博客-技术-分享-免费博客右下角限时VIP](https://img.a686.de/file/1745834276493_微信截图_20250428175718.png)
感谢您的来访,获取更多精彩文章请收藏本站。

© 版权声明
文章版权归作者所有,未经允许请勿转载。声明:下载本站资源即同意用户协议,本站程序只是提供给开发者学习研究。
THE END
暂无评论内容