我想让一个图标出现在一个点击后删除的图标上
I want to make an icon appear over one that deletes after clicking it
http://www.foundersfund.com/
注意这个页面,当你点击右上角的菜单按钮时,一个前
按钮出现,您可以从中单击该按钮并将菜单放回原处,这
是我想要的,但这是我的网页正在做的,试试看:file:///Users/MacbookPro2011/Desktop/RedWeave/JQuery/redweave.html
here is my code:
<body>
<div id="mainBar">
<div id="menuButton">
<div id="exButton"></div>
</div>
</div>
<script text="type/javascript">
$("#menuButton").click(function() {
$("#mainBar").animate({ height:"300px" },500);
$("#menuButton").animate({ height:"0px", width:"0px"},5);
$("#exButton").animate({ height:"30px", width:"30px"},5);
});
$("#exButton").click(function() {
$("#mainBar").animate({ height:"100px" },500);
$("#menuButton").animate({ height:"30px", width:"30px"},5);
$("#exButton").animate({ height:"0px", width:"0px"},5);
});
</script>
这是我创建的一个简单片段,我认为您自己从这里开始会更容易。
$("#menuButton").click(function() {
$("#menuButton").toggleClass("close");
$(".main-menu").toggleClass("expanded");
if ($("#mainBar").hasClass("collapsed")) {
$("#mainBar").animate({
"height": "400px"
}, function() {
$("#mainBar").removeClass("collapsed");
});
} else {
$("#mainBar").animate({
"height": "80px"
}, function() {
$("#mainBar").addClass("collapsed");
});
}
});
@import url('http://getbootstrap.com/dist/css/bootstrap.css');
#menuButton {
background: url(https://cdn4.iconfinder.com/data/icons/wirecons-free-vector-icons/32/menu-alt-512.png) no-repeat;
background-size: 100%;
width: 32px;
height: 32px;
cursor: pointer;
position: absolute;
top: 24px;
left: 24px;
}
#menuButton.close {
background: url(https://cdn3.iconfinder.com/data/icons/eightyshades/512/18_Close-128.png) no-repeat;
background-size: 100%;
}
#mainBar {
background: #DDDDDD;
position: relative;
}
#mainBar.collapsed {
height: 80px;
}
.menu-header {
display: table;
width: 100%;
height: 100%;
}
ul>li {
list-style: none;
}
ul.main-menu {
display: none;
text-align: center;
height: 330px;
vertical-align: middle;
}
ul.main-menu.expanded {
display: table-cell;
}
ul.main-menu li>a {
font-size: 21px;
font-weight: bold;
color: #000000;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<div id="mainBar" class="collapsed">
<div id="menuButton"></div>
<div class="menu-header">
<ul class="main-menu" style="">
<li><a href="#">Manifesto</a>
</li>
<li><a href="#">Portfolio</a>
</li>
<li><a href="#">Team</a>
</li>
</ul>
</div>
</div>
http://www.foundersfund.com/ 注意这个页面,当你点击右上角的菜单按钮时,一个前 按钮出现,您可以从中单击该按钮并将菜单放回原处,这 是我想要的,但这是我的网页正在做的,试试看:file:///Users/MacbookPro2011/Desktop/RedWeave/JQuery/redweave.html
here is my code:
<body>
<div id="mainBar">
<div id="menuButton">
<div id="exButton"></div>
</div>
</div>
<script text="type/javascript">
$("#menuButton").click(function() {
$("#mainBar").animate({ height:"300px" },500);
$("#menuButton").animate({ height:"0px", width:"0px"},5);
$("#exButton").animate({ height:"30px", width:"30px"},5);
});
$("#exButton").click(function() {
$("#mainBar").animate({ height:"100px" },500);
$("#menuButton").animate({ height:"30px", width:"30px"},5);
$("#exButton").animate({ height:"0px", width:"0px"},5);
});
</script>
这是我创建的一个简单片段,我认为您自己从这里开始会更容易。
$("#menuButton").click(function() {
$("#menuButton").toggleClass("close");
$(".main-menu").toggleClass("expanded");
if ($("#mainBar").hasClass("collapsed")) {
$("#mainBar").animate({
"height": "400px"
}, function() {
$("#mainBar").removeClass("collapsed");
});
} else {
$("#mainBar").animate({
"height": "80px"
}, function() {
$("#mainBar").addClass("collapsed");
});
}
});
@import url('http://getbootstrap.com/dist/css/bootstrap.css');
#menuButton {
background: url(https://cdn4.iconfinder.com/data/icons/wirecons-free-vector-icons/32/menu-alt-512.png) no-repeat;
background-size: 100%;
width: 32px;
height: 32px;
cursor: pointer;
position: absolute;
top: 24px;
left: 24px;
}
#menuButton.close {
background: url(https://cdn3.iconfinder.com/data/icons/eightyshades/512/18_Close-128.png) no-repeat;
background-size: 100%;
}
#mainBar {
background: #DDDDDD;
position: relative;
}
#mainBar.collapsed {
height: 80px;
}
.menu-header {
display: table;
width: 100%;
height: 100%;
}
ul>li {
list-style: none;
}
ul.main-menu {
display: none;
text-align: center;
height: 330px;
vertical-align: middle;
}
ul.main-menu.expanded {
display: table-cell;
}
ul.main-menu li>a {
font-size: 21px;
font-weight: bold;
color: #000000;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<div id="mainBar" class="collapsed">
<div id="menuButton"></div>
<div class="menu-header">
<ul class="main-menu" style="">
<li><a href="#">Manifesto</a>
</li>
<li><a href="#">Portfolio</a>
</li>
<li><a href="#">Team</a>
</li>
</ul>
</div>
</div>