万能的界面切换 -- 模板教程
来源:互联网 发布:淘宝网收藏宝贝 编辑:程序博客网 时间:2024/04/27 12:20
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>banner</title>
<style type="text/css">
body {
text-align: center;
}
#show {
width: 260px;
height: 300px;
border: 5px solid goldenrod;
overflow: hidden;
position: relative;
margin: 0 auto;
}
#contant {
width: 1300px;
position: absolute;
left: 0;
transition: all 0.5s;
}
#contant> div {
width: 260px;
float: left;
line-height: 300px;
text-align: center;
font-size: 30px;
}
#contant> div:nth-child(1){
background-color: red;
}
#contant> div:nth-child(2){
background-color: greenyellow;
}
#contant> div:nth-child(3){
background-color: blue;
}
#contant> div:nth-child(4){
background-color: orange;
}
#contant> div:nth-child(5){
background-color: cyan;
}
</style>
</head>
<body>
<div id="banner">
<div id="button-group">
<button>1</button>
<button>2</button>
<button>3</button>
<button>4</button>
<button>5</button>
</div>
<div id="show">
<div id="contant">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
var button = document.querySelectorAll("#button-group > button");
var contentDiv = document.getElementById("contant");
function clickButton() {
for(var i = 0; i < button.length; i++) {
if(this == button[i]) {
break;
}
}
contentDiv.style.left = -260 * i + "px";
contentDiv.style.left = -260 * (this.innerHTML - 1) + "px";
}
for(var i = 0; i < button.length; i++) {
button[i].onclick = clickButton;
}
</script>
</html>
<html>
<head>
<meta charset="UTF-8">
<title>banner</title>
<style type="text/css">
body {
text-align: center;
}
#show {
width: 260px;
height: 300px;
border: 5px solid goldenrod;
overflow: hidden;
position: relative;
margin: 0 auto;
}
#contant {
width: 1300px;
position: absolute;
left: 0;
transition: all 0.5s;
}
#contant> div {
width: 260px;
float: left;
line-height: 300px;
text-align: center;
font-size: 30px;
}
#contant> div:nth-child(1){
background-color: red;
}
#contant> div:nth-child(2){
background-color: greenyellow;
}
#contant> div:nth-child(3){
background-color: blue;
}
#contant> div:nth-child(4){
background-color: orange;
}
#contant> div:nth-child(5){
background-color: cyan;
}
</style>
</head>
<body>
<div id="banner">
<div id="button-group">
<button>1</button>
<button>2</button>
<button>3</button>
<button>4</button>
<button>5</button>
</div>
<div id="show">
<div id="contant">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
var button = document.querySelectorAll("#button-group > button");
var contentDiv = document.getElementById("contant");
function clickButton() {
for(var i = 0; i < button.length; i++) {
if(this == button[i]) {
break;
}
}
contentDiv.style.left = -260 * i + "px";
contentDiv.style.left = -260 * (this.innerHTML - 1) + "px";
}
for(var i = 0; i < button.length; i++) {
button[i].onclick = clickButton;
}
</script>
</html>
0 0
- 万能的界面切换 -- 模板教程
- 作文的万能模板
- Axure RP 万能的标签切换面板-动态面板切换
- cocos2dx中Android.mk的万能模板
- Androidd打造万能的Fragment切换帮助类
- IPhone的界面切换方法
- Android 的界面切换方法
- android 界面切换的方法
- Intent--界面之间的切换
- Android中界面的切换
- android界面切换的方法
- android界面切换的方法
- android界面切换的方法
- 仿QQ界面的切换
- 闪屏界面的切换
- 示波器界面的中英文切换
- 使用 自定义布局 实现灵活的万能遥控器界面
- 万能领导讲话模板
- Python: 文件操作与数据读取
- disabled="true"
- 自定义gft动态图
- Unity场景导出01字符串A星数据
- 无限轮播图
- 万能的界面切换 -- 模板教程
- UVALive 7271 A Math Problem 【数位dp计数】
- iOS毛玻璃效果的实现及图片模糊效果的三种方法
- 贪吃蛇背景 - 宫格布局
- MyBatis一对一关系映射
- Mac Launchpad出现两个相同快捷方式的解决办法
- 月经刚完会怀孕吗 月经完后几天可以同房_同房受孕_准妈妈孕妇网
- JQ自动选中导航栏
- Oracle 11g数据库安装后7个服务详解