简单穿梭框代码
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了简单穿梭框代码,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1869字,纯文字阅读大概需要3分钟。
内容图文
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>穿梭框</title>
<link rel="stylesheet" href="index.css">
<script src="jquery.min.js"></script>
<style>
ul,
li {
margin: 0;
padding: 0;
list-style: none;
}
body {
background-color: #e3e3e3;
margin: 0px;
}
.box {
width: 300px;
background-color: #ffffff;
height: 240px;
float: left;
}
.Path {
color: #ffffff !important;
background-color: #1890ff !important;
border-bottom: 1px solid #ffffff;
transition: all .01s;
}
.box li {
padding: 8px;
border-bottom: 1px solid #ffffff;
background-color: #f4f4f4;
cursor: pointer;
transition: all .5s;
}
#btn {
height: 240px;
float: left;
width: 80px;
text-align: center;
}
#btn button {
width: 50px;
height: 30px;
display: block;
margin: 20px auto;
line-height: 30px;
color: white;
cursor: pointer;
background-color: #1890ff;
border-radius: 5px;
transition: all .5s;
border: none;
}
</style>
</head>
<body>
<li class="box">
<ul id="shuttleLeft">
<li>王小婷1</li>
<li>王小婷2</li>
<li>王小婷3</li>
</ul>
</li>
<li id="btn">
<button id="toRight">></button>
<button id="toLeft"><</button>
</li>
<li class="box">
<ul id="shuttleRight">
<li>祈澈菇凉1</li>
<li>祈澈菇凉2</li>
<li>祈澈菇凉3</li>
</ul>
</li>
</body>
<script>
//穿梭框左侧选中
$("#shuttleLeft").on('click', 'li', function() {
if($(this).hasClass('Path')) {
$(this).removeClass('Path');
} else {
$(this).addClass('Path');
}
});
//穿梭框右侧选中
$("#shuttleRight").on('click', 'li', function() {
if($(this).hasClass('Path')) {
$(this).removeClass('Path');
} else {
$(this).addClass('Path');
}
});
//向右移动
$("#toRight").click(function() {
if($("#shuttleLeft .Path").length == 0) return false;
$("#shuttleLeft").find('.Path').appendTo("#shuttleRight");
$("#shuttleRight li").removeClass('Path');
});
//向左移动
$("#toLeft").click(function() {
if($("#shuttleRight .Path").length == 0) return false;
$("#shuttleRight .Path").appendTo("#shuttleLeft");
$("#shuttleLeft li").removeClass('Path');
});
</script>
</html>
内容总结
以上是互联网集市为您收集整理的简单穿梭框代码全部内容,希望文章能够帮你解决简单穿梭框代码所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。