当前位置:网站首页>JS click the button to slide to the left
JS click the button to slide to the left
2022-06-10 12:55:00 【000000001111】
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Slide effect to the left </title>
<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<style>
* {
margin: 0;
padding: 0;
}
img {
border: 0;
}
li {
list-style: none;
}
a {
text-decoration: none;
}
.btn {
width: 100px;
height: 30px;
line-height: 30px;
border: 1px solid;
margin: 0 auto;
margin-top: 100px;
text-align: center;
cursor: pointer;
border-radius: 6px;
}
.btn_show {
width: 100%;
height: 100%;
display: none;
}
.btn_show_bg {
width: 100%;
height: 100%;
background: #000;
position: fixed;
top: 0;
left: 0;
opacity: 0.5;
}
.btn_show_main {
width: 300px;
height: 100%;
background: #fff;
position: fixed;
top: 0;
right: -300px;
}
.btn_show_main_close {
font-size: 14px;
width: 100px;
height: 20px;
line-height: 20px;
text-align: center;
cursor: pointer;
}
.div_right0 {
animation: myfirstss 2s;
-moz-animation: myfirstss 2s;
/* Firefox */
-webkit-animation: myfirstss 2s;
/* Safari and Chrome */
-o-animation: myfirstss 2s;
/* Opera */
animation-fill-mode: forwards;
}
@keyframes myfirstss {
100% {
background: red;
right: 0px;
top: 0px;
}
}
.div_right {
animation: myfirsts 2s;
-moz-animation: myfirsts 2s;
/* Firefox */
-webkit-animation: myfirsts 2s;
/* Safari and Chrome */
-o-animation: myfirsts 2s;
/* Opera */
animation-fill-mode: forwards;
right: 0px;
}
@keyframes myfirsts {
100% {
background: blue;
right: -300px;
top: 0px;
}
}
.btn_show_main ul li {
width: 100%;
height: 20px;
line-height: 20px;
text-align: center;
font-size: 14px;
margin-bottom: 10px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="btn"> Button </div>
<div class="btn_show">
<div class="btn_show_bg"></div>
<div class="btn_show_main">
<div class="btn_show_main_close"> I'm closing </div>
<ul>
<li> I am a 1</li>
<li> I am a 2</li>
<li> I am a 3</li>
<li> I am a 4</li>
<li> I am a 5</li>
<li> I am a 6</li>
<li> I am a 7</li>
<li> I am a 8</li>
<li> I am a 9</li>
<li> I am a 10</li>
</ul>
</div>
</div>
</body>
<script>
window.onload = function() {
$(".btn").click(function() {
$(".btn_show").show();
$(".btn_show_bg").show();
$(".btn_show_main").addClass('div_right0');
$(".btn_show_main").removeClass('div_right')
});
$(".btn_show_main_close").click(function() {
$(".btn_show_main").addClass('div_right');
$(".btn_show_main").removeClass('div_right0');
$(".btn_show_bg").hide(2000);
});
};
</script>
</html>

边栏推荐
- 统计100以内的各位数之和为7的自然数的个数及平均值
- Start with interpreting the code automatically generated by BDC, and explain the program components of sapgui
- MySQL master database operation large table DDL, slave database crash and system parameter error setting
- CC2642R 蓝牙MCU芯片的学习
- Altium Allegro PADS到底该选哪个EDA设计软件
- C # implement bubble form
- Automatic Mapping of Tailored Landmark Representations for Automated Driving and Map Learning 论文阅读
- Shadergraph - 302 swimming Dragon
- Office technical lecture: punctuation - Chinese - vertical
- UML类图
猜你喜欢

(5) Class, object and class file splitting operation (2)

手机厂商“返祖”,只有苹果说不

如何才能把团队给带解散。。。

VDMA调试总结

Today, a couple won the largest e-commerce IPO in Hong Kong

Learning of fm4057s single lithium battery linear charging chip

Alibaba cloud ECS server builds MySQL database

Daniel recommended and hanged the interviewer

JTAG-to-AXI Master调试AXI BRAM Controller

别把“IT信息化”不当“超级工程”
随机推荐
VDMA调试总结
[mobile robot] principle of wheel odometer
VDMA commissioning summary
If the files and graphics are lost, it means that you don't need the office developed by yourself
Wechat web development tool tutorial, the company develops Web
Mobile phone manufacturers "go back to their ancestors", only apple said no
JTAG-to-AXI Master调试AXI BRAM Controller
The Japanese version of arXiv is a cool batch: only 37 papers have been received after more than 2 months
技术分享| 快对讲,全球对讲
colmap源码阅读笔记[1] threading.cc
excel异步导出
极简随机音乐播放器
Ant financial services Yang Jun: evolution of ant data analysis platform and application of data analysis methods
Baidu programmers were sentenced to nine months for deleting the database. The one click unbinding function of the mobile phone number was released. Twitter compromised with musk again. Today, more bi
用C语言创建基本的栈与队列
Recommended learning materials for Altium Designer
Count the number and average value of natural numbers whose sum of bits within 100 is 7
Const Modified member function
What if the xshell evaluation period has expired? Follow the steps below to solve the problem!
MySQL service evolution