Commit 2cd9313e by li

luodiye

parents
var data = {
url:"https://www.baidu.com",
bg:"./static/bg.webp",
btn:"./static/btn.webp"
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div id="bgParent">
<img id="bg" alt="" onclick="goto()"/>
<img onclick="goto()" src="./static/btn.webp" style="width: 260px;" alt="" id="btn"/>
</div>
</body>
<style>
@media screen and (min-width: 992px) {
#bg{
height: 100%;
}
}
@media screen and (max-width: 992px) {
#bg{
width: 100%;
object-fit: cover;
}
}
#bgParent{
display: flex;
justify-content: center;
}
body{
margin: 0;
padding: 0;
overflow: hidden;
}
#btn{
animation: scale .4s linear infinite alternate;
position: absolute;
z-index: 10;
top:40%;
}
@keyframes scale {
0% {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(1);
}
}
</style>
<script src="./data.json"></script>
<script>
function init(){
document.getElementById('bgParent').style.height = window.innerHeight+'px'
document.getElementById('bg').src = data.bg
document.getElementById('btn').src = data.btn
}
init()
function goto(){
window.open(data.url,'_blank')
}
</script>
</html>
\ No newline at end of file
File added
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment