【向快乐看齐】- 吕继宏 (答谢帖)
<style type="text/css">
/* 帖子容器 */
#tzDiv {
position: relative;
left: -214px;
width: 1080px;
height: 614px;
top: 80px;
background: #eee url('https://pic.imgdb.cn/item/6260f2c7239250f7c5bec38f.jpg') no-repeat center/cover;
opacity: 0.8;
}
/* 音乐控制按钮 */
.picBtn {
position: absolute;
width: 80px;
height: 80px;
left: 200px;
bottom: 260px;
border: none;
outline: none;
border-radius: 8px;
background: transparent url('https://pic.imgdb.cn/item/6243df5b27f86abb2a5598f1.gif') no-repeat;
cursor: pointer;
}
/* 文本时钟 */
#textClock {
position: absolute;
top: 180px;
right: 200px;
width: 300px;
height: 30px;
font: 20px / 30px Sans-Serif;
text-align: center;
}
/* 走马灯父框 */
.txtFly {
position: absolute;
width: 260px;
height: 30px;
right: 100px;
bottom: 100px;
overflow: hidden;
}
/* 走马灯文本 */
.txtFly div {
position: absolute;
left: 260px;
font: normal 18px /20px Sans-Serif;
word-break: keep-all;
white-space:nowrap;
}
/* 变色文本 */
.txtBg {
position: absolute;
top: 80px;
right: 100px;
font-size: 3rem;
color: transparent;
width: 500px;
height: 100px;
line-height: 100px;
text-align: center;
background-image: linear-gradient(90deg, green, olive, transparent, tomato, green);
background-size: 500px 100px;
background-position: 500px 0;
border: 1px solid;
background-clip: text;
-webkit-background-clip: text;
animation: chgc 2s linear infinite;
}
/* 文本变色动画 */
@keyframes chgc {
from { background-position: -500px 0; }
to { background-position: 0 0; }
}
</style>
<div id="tzDiv">
<div class="txtBg">向快乐看齐 </div>
<div id="textClock"></div>
<div class="txtFly">
<div id="ziFly">向快乐看齐- 吕继宏
</div>
</div>
<button id="picBtn" class="picBtn"></button>
<audio id="music" src="https://music.163.com/song/media/outer/url?id=126214.mp3" loop="loop" autoplay="autoplay" ></audio>
</div>
<script language="javascript">
fly(); //运行走马灯
showTime(); //显示时间
setInterval(showTime, 1000); //运行时钟
//文本时钟函数
function showTime(){
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth() + 1;
var date = now.getDate();
var day = now.getDay();
var hour = now.getHours();
if(hour < 10) hour = "0" + hour;
var minute = now.getMinutes();
if(minute < 10) minute = "0" + minute;
var second = now.getSeconds();
if(second < 10) second = "0" + second;
document.getElementById("textClock").innerHTML = year + "年" + month + "月" + date + "日 星期" + toHz(day) + "" + hour + ":" + minute + ":" + second;
}
function toHz(num) { var hz = "日一二三四五六九"; return(hz.charAt(num)); }
//音乐控制代码
var mu = document.getElementById('music');
var btn = document.getElementById('picBtn');
btn.onclick = function(){
mu.paused ? (mu.play(), btn.style.background="url('https://pic.imgdb.cn/item/6243df5b27f86abb2a5598f1.gif')") : (mu.pause(), btn.style.background="url('https://pic.imgdb.cn/item/6243df9527f86abb2a5660b9.png')");
}
mu.addEventListener("ended", function(){
btn.style.background="url('https://pic.imgdb.cn/item/6243df9527f86abb2a5660b9.png')";
});
//创建走马灯
function fly() {
var ziFly = document.getElementById('ziFly');
var width = ziFly.clientWidth;
var style = document.createElement('style');
style.type = 'text/css';
var flyStr = '@keyframes fly {to { left: -' + width + 'px; } }';
style.innerHTML = flyStr;
ziFly.appendChild(style);
ziFly.style.animation = 'fly 40s linear infinite';
}
</script>
<br><br><br><br><br>
本帖最后由 加林森 于 2022-4-21 20:46 编辑
@马黑黑 @樵歌 @红影 @大猫咪 @红芍药 @闲言不语@绿叶清舟 @梦油 @东篱闲人 @千羽
谢谢你们的祝福,加加送此帖回敬大家了。 队长真快啊{:5_166:} 再祝生日快乐 绿叶清舟 发表于 2022-4-21 20:46
队长真快啊
必须的啊。{:4_176:} 绿叶清舟 发表于 2022-4-21 20:46
再祝生日快乐
谢谢清舟了,来分享:{:5_166:} 挺给力的 制作的漂亮,再祝队长生日快乐! 加林森 发表于 2022-4-21 20:47
必须的啊。
{:4_176:}来干了 马黑黑 发表于 2022-4-21 20:50
挺给力的
谢谢老黑了!{:4_191:} 加林森 发表于 2022-4-21 20:51
谢谢老黑了!
{:4_190:} 闲言不语 发表于 2022-4-21 20:50
制作的漂亮,再祝队长生日快乐!
谢谢不语了。{:4_176:} 马黑黑 发表于 2022-4-21 20:51
{:4_191:}你请喝。 绿叶清舟 发表于 2022-4-21 20:50
来干了
好,干!{:4_176:} 放了几个元素都挺好的,{:4_187:} 队长,生日快乐,开心享受每一天{:4_187:} 千羽 发表于 2022-4-21 21:11
放了几个元素都挺好的,
嗯嗯,谢谢!{:4_204:} 千羽 发表于 2022-4-21 21:12
队长,生日快乐,开心享受每一天
好的好的,会的。大家一起开心!{:4_204:}{:4_190:} 队长今天生日,不好好安心过生日,这么快地回礼啊。
真漂亮的制作,再祝队长生日快乐{:4_187:} 红影 发表于 2022-4-21 21:28
队长今天生日,不好好安心过生日,这么快地回礼啊。
真漂亮的制作,再祝队长生日快乐
谢谢红影支持!{:4_187:}
页:
[1]
2