html css js 项目练习,HTML与css和js综合练习

HTML+JS+CSS综合练习

给大家带来一波干货!!

希望对大家有用

一、 滑动样式

login.html

Login

Sign Up

Username

Password

True Name

Submit

Or, Sign In

Sign In

Username

Password

Sign In

Or, Sign Up

login.jpg

main.js:

var toggleBtns = document.querySelectorAll('.js-formToggle');

for(var i = 0; i < toggleBtns.length; i++){

toggleBtns[i].addEventListener("click",toggleForm);

}

var firstClick = true;

function toggleForm(){

if(!firstClick){

document.querySelector('.js-imageAnimate').classList.toggle("animate");

document.querySelector('.js-imageAnimate').classList.toggle("animateOut");

document.querySelector('.js-panel_content').classList.toggle("animate");

document.querySelector('.js-panel_content').classList.toggle("animateOut");

}

else{

firstClick = false;

document.querySelector('.js-imageAnimate').classList.add("animate");

document.querySelector('.js-panel_content').classList.add("animate");

}

}

default.css:

body, html{

font-family: Ariel, sans-serif;

width:100%;

height:100%;

margin:0;

padding:0;

display:inline-block;

}

.page{

display:flex;

flex-flow:row;

flex-wrap:nowrap;

align-items:center;

justify-content:center;

width:100%;

height:100%;

background-color: #0f95b0;

}

.panel{

display:inline-block;

position:relative;

}

.panel_visible{

position:relative;

overflow: hidden;

}

.panel_title{

margin-top: .5em;

margin-bottom: 1.2em;

}

.panel_content{

padding: 20px;

background-color: white;

z-index:10;

position:relative;

}

.panel_content-overlay{

position:absolute;

top:0;

left:100%;

height:100%;

}

.panel_content.animate{

animation: movePanel 2s forwards ;

}

@keyframes movePanel{

0%, 30%{

transform: translateX(0%);

}

35%, 100%{

transform: translateX(-100%);

}

}

.panel_content.animateOut{

animation: movePanelOut 2s forwards ;

}

@keyframes movePanelOut{

0%, 30%{

transform: translateX(-100%);

}

35%, 100%{

transform: translateX(0%);

}

}

.panel_back{

position:absolute;

z-index:0;

top:50%;

left: 0;

width:110%;

transform: translate(70%,-50%);

}

.panel_back.animate{

animation: move 2s forwards ;

}

@keyframes move{

0%{

transform: translate(70%,-50%);

z-index:0;

}

15%{

transform: translate(140%,-50%);

z-index:10;

}

75%{

transform: translate(-120%,-50%);

z-index:10;

}

100%{

transform: translate(-50%,-50%);

z-index:0;

}

}

.panel_back.animateOut{

transform: translate(-50%,-50%);

animation: moveOut 2s forwards ;

}

@keyframes moveOut{

0%{

transform: translate(-50%,-50%);

z-index:0;

}

15%{

transform: translate(-120%,-50%);

z-index:10;

}

75%{

transform: translate(140%,-50%);

z-index:10;

}

100%{

transform: translate(70%,-50%);

z-index:0;

}

}

.panel_img{

width:100%;

display:block;

}

/* Form */

.form{

box-sizing:border-box;

}

.form_label{

display:block;

color: #3D3D3D;

font-weight: 600;

margin-bottom: 5px;

}

.form_input{

border-radius: 3px;

background-color: #f2f2f2 ;

box-shadow: 0px 2px 2px #D6D6D6;

border:none;

padding: 2%;

margin-bottom: 15px;

width: 250px;

box-sizing:border-box;

position:relative;

}

.form_input:focus{

box-shadow: none;

outline-color: #0f95b0;

}

.form_input::after{

/* TODO: make this after portion work */

content: "

标签:container,100%,50%,transform,js,width,HTML,section,css

来源: https://blog.csdn.net/weixin_46331127/article/details/117752261

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值