码迷,mamicode.com
首页 > 其他好文 > 详细

navDemo

时间:2016-11-16 02:26:10      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:cancel   boot   微软雅黑   char   btn   pos   play   remove   12px   

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
*{
margin: 0;
padding: 0;
}
html,body{
width: 100%;
height: 100%;
font-size: 16px;
font-family: "微软雅黑";
}
ul,li{
list-style: none;
}
.box{
width: 100%;
height: 100%;
background: lightblue;
}
.box header{
width: 100%;
height: 60px;
background: lightcoral;
}
.logo{
width: 100px;
height: 100%;
background: blue;
float: left;
line-height: 60px;
text-align: center;
}
.nav{
height: 100%;
float: left;
}
.nav li{
float: left;
height: 100%;
width: 50px;
line-height: 60px;
text-align: center;
}
.edit{
float: left;
height: 100%;
width: 50px;
line-height: 60px;
background: lavender;
text-align: center;
position: relative;
}
.edit .selectBox{
display: none;
width: 200px;
/*height: 200px;*/
position: absolute;
top: 60px;
left: 0;
background: lightseagreen;
z-index: 999;
}
.selectBox .selected{
width: 100%;
height: 100px;
background: lightsteelblue;
}
.selectBox .unselected{
width: 100%;
height: 100px;
background: lightgray;
}
.selectBox .selectTitle{
height: 20px;
line-height: 20px;
text-align: center;
}
.selectBox li{
width: 60px;
height: 30px;
float: left;
border: 1px solid #333;
font-size: 12px;
line-height: 30px;
margin: 2px;
position: relative;
}
.selectBox li i{
font-style: normal;
position: absolute;
right: 0;
top: 0;
width: 12px;
height: 12px;
background: yellowgreen;
line-height: 10px;
font-size: 12px;
}
.btn span{
float: left;
width: 50%;
height: 30px;
line-height: 30px;
}
.btn span:nth-of-type(1){
border-right:1px solid #333 ;
box-sizing: border-box;
}
</style>
</head>
<body>
<div class="box">
<header>
<div class="logo">logo</div>
<ul class="nav">
<li>首页</li>
<li>邮件</li>
</ul>
<div class="edit">
+
<div class="selectBox">
<div class="selected">
<p class="selectTitle">已选择</p>
<ul class="selectedCon">
<li class="fixedItem">首页</li>
<li class="fixedItem">邮件</li>
</ul>
</div>
<div class="unselected">
<p class="selectTitle">未选择</p>
<ul class="unselectedCon">
<li><span>人事</span><i>x</i></li>
<li><span>IT</span><i>x</i></li>
<li><span>工号</span><i>x</i></li>
</ul>
</div>
<div class="btn"><span id="confirm">确定</span><span id="cancel">取消</span></div>
</div>
</div>
</header>
</div>

<script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script>
$(".edit").click(function(){
$(".selectBox").show();
})
$(".selectBox ul").on("click","i",function(){
$(this).parent().remove();
return false;
})
$(".unselectedCon").on("click","li",function(){
// $(".selectedCon").append("<li>"+$(this).html()+"<i>x</i></li>")
// $(this).remove();
$(".selectedCon").append($(this))
})
$(".selectedCon").on("click","li:not(‘.fixedItem‘)",function(){
// $(".unselectedCon").append("<li>"+$(this).html()+"<i>x</i></li>")
// $(this).remove();
$(".unselectedCon").append($(this))
})
$("#confirm").click(function(){
$(".nav").html("<li>首页</li><li>邮件</li>");
var n = $(".selectedCon li").length;
for(var m=2;m<n;m++){
var con = $(".selectedCon li").eq(m).find("span").html();
$(".nav").append("<li>"+con+"</li>");
}
$(".selectBox").hide();
return false;
})
$("#cancel").click(function(){
$(".selectBox").hide();
return false;
})
</script>
</body>
</html>

navDemo

标签:cancel   boot   微软雅黑   char   btn   pos   play   remove   12px   

原文地址:http://www.cnblogs.com/mxy666/p/6067980.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!