JS泡泡动效,登录注册界面动态背景效果


代码效果:
html代码:
<div class="box">
<div class="pre-box">
<h1>WELCOME</h1>
<p>JOIN US!</p>
<div class="img-box">
<img src="https://chimengblog.com/wpimg.php" >
</div>
</div>
<div class="register-form">
<div class="title-box">
<h1>注册</h1>
</div>
<div class="input-box">
<input type="text" placeholder="用户名">
<input type="password" placeholder="密码">
<input type="password" placeholder="确认密码">
</div>
<div class="btn-box">
<button>注册</button>
<p onclick="mySwitch()">已有有账号?去登录</p>
</div>
</div>
<div class="login-form">
<div class="title-box">
<h1>登录</h1>
</div>
<div class="input-box">
<input type="text" placeholder="用户名">
<input type="password" placeholder="密码">
</div>
<div class="btn-box">
<button>登录</button>
<p onclick="mySwitch()">没有账号?去注册</p>
</div>
</div>
</div>
CSS代码:
*{
padding: o;
margin: 0;
box-sizing: border-box;
}
input{
outline: none;
}
html,
body{
height: 100%;
}
body{
position: relative;
overflow-x: hidden;
display: flex;
background: linear-gradient(to right, rgb(247, 209, 215), rgb(191, 227, 241));
}
span{
position: absolute;
bottom: 0;
background: radial-gradient(circle at 72% 28%, #fff 3px, #ff7edf 8%, #5b5b5b, #aad7f9 100%);
box-shadow: inset 0 0 6px #fff,
inset 3px 0 6px #eaf5fc,
inset 2px -2px 10px #efcde6,
inset 0 0 60px #f9f6de,
0 0 20px #fff;
border-radius: 50%;
z-index: 0;
animation: mymove 4s linear infinite;
}
@keyframes mymove {
0%{
transform: translateY(0%);
opacity: 1;
}
50%{
transform: translate(10%,-1000%);
}
75%{
transform: translate(-20%,-1200%);
}
99%{
opacity: .9;
}
100%{
transform: translateY(-1800%) scale(1.5);
opacity: 0;
}
}
.box{
width: 1050px;
height: 600px;
display: flex;
position: relative;
z-index: 2;
/* background-color: #fff; */
margin: auto;
border-radius: 8px;
border: 1px solid rgb(255, 255, 255, .6);
box-shadow: 4px 4px 3px rgb(0, 0, 0, .1);
}
.pre-box{
width: calc(1050px /2);
height: 100%;
left: 0;
top: 0;
position: absolute;
border-radius: 4px;
background-color: #edd4dc;
box-shadow: 4px 4px 3px rgb(0, 0, 0, .1);
transition: 0.5s ease-in-out;
}
.pre-box h1{
margin-top: 150px;
text-align: center;
color: white;
letter-spacing: 5px;
text-shadow: 4px 4px 3px rgb(0, 0, 0, .1);
}
.pre-box p{
height: 30px;
line-height: 30px;
text-align: center;
color: white;
margin: 20px 0;
font-weight: bold;
text-shadow: 4px 4px 3px rgb(0, 0, 0, .1);
}
.img-box{
width: 200px;
height: 200px;
margin: 20px auto;
border-radius: 50%;
overflow: hidden;
box-shadow: 4px 4px 3px rgb(0, 0, 0, .1);
}
.img-box img{
width: 100%;
transition: 0.5s;
}
.login-form,
.register-form{
flex: 1;
height: 100%;
}
.title-box{
height: 300px;
line-height: 500px;
}
.title-box h1{
text-align: center;
color: white;
letter-spacing: 5px;
text-shadow: 4px 4px 3px rgb(0, 0, 0, .1);
}
.input-box{
display: flex;
flex-direction: column;
align-items: center;
}
input{
width: 60%;
height: 40px;
margin-bottom: 20px;
text-indent: 4px;
border: 1px solid #b0cfe9;
border-radius: 4px;
}
input:focus{
color: #b0cfe9;
}
input:focus::placeholder{
opacity: 0;
}
.btn-box{
display: flex;
justify-content: center;
}
button{
width: 100px;
height: 30px;
margin: 0 7px;
line-height: 30px;
border-radius: 4px;
border: none;
background-color: #69b3f0;
color: #fff;
}
button:hover{
cursor: pointer;
opacity: .8;
}
.btn-box p{
height: 30px;
line-height: 30px;
font-size: 14px;
color: white;
}
.btn-box p:hover{
cursor: pointer;
border-bottom: 1px solid white;
}
JS代码:
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
let flag=true
const mySwitch=()=>{
if(flag){
$(".pre-box").css("transform","translateX(100%)")
$(".pre-box").css("background-color","#c9e0ed")
$("img").attr("src","https://mscar.oss-cn-chengdu.aliyuncs.com/-329db57fe5070299.png")
}else{
$(".pre-box").css("transform","translateX(0%)")
$(".pre-box").css("background-color","#edd4dc")
$("img").attr("src"," https://mscar.oss-cn-chengdu.aliyuncs.com/2022/07/20220710163814306.jpg")
}
flag=!flag
}
</script>
<script>
const buleCreate=()=>{
const body = document.body
const buble = document.createElement('span')
let r = Math.random()*5 + 25
buble.style.width=r+'px'
buble.style.height=r+'px'
buble.style.left=Math.random()*innerWidth+'px'
body.append(buble)
setTimeout(()=>{
buble.remove()
},4000)
}
setInterval(() => {
buleCreate()
}, 200);
</script>
© 版权声明
本站网络名称:
蚩梦博客
本站永久网址:
https://chimengblog.com/
网站侵权说明:
本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长QQ45096653删除处理。
1 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
2 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
3 本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。
1 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
2 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
3 本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。
THE END
- 最新
- 最热
只看作者