|
|
本帖最后由 风中飞尘 于 2023-4-3 13:02 编辑
大概是这类似的,,
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title>Hover Animation</title>
- <style>
- .link {
- position: relative;
- display: inline-block;
- padding: 10px;
- color: #000;
- text-decoration: none;
- font-size: 24px;
- font-weight: bold;
- transition: all 0.3s ease;
- }
- .link:hover:before {
- content: "";
- position: absolute;
- top: 50px;
- left: 0;
- width: 150px;
- height: 36px;
- background: url("https://pan.111t.net/updir/zp/20230401124807.png") no-repeat;
- background-size: cover;
- animation: flyIn 0.5s forwards;
- z-index: -1;
- }
- @keyframes flyIn {
- 0% {
- transform: translateX(-100%);
- }
- 100% {
- transform: translateX(0);
- }
- }
-
- </style>
-
- <script>
- var audio = new Audio(); // 创建一个 Audio 对象
- audio.src = "https://pan.111t.net/updir/zp/20230401131834.mp3"; // 设置音频文件路径
- function playSound() {
- audio.play(); // 播放音频
- }
- </script>
-
- </head>
- <body>
- <a href="#" class="link" onmouseover="playSound()" >这是一个链接!测试链接</a>
- </body>
- </html>
- ```
- 你需要将`your-image-url-here`替换为你想要使用的图片的URL。
复制代码 |
|