[英]Slide right and left - jquery
Suppose I have a list of tasks taking the width of the screen. 假设我有一个任务列表,占用屏幕的宽度。 When I click on one of them, that it slides to the left to occupy the 50% of the with of the screen, and that, at the same time, slides from the right of the screen some details about the clicked task. 当我单击其中一个时,它会向左滑动以占据屏幕显示的50%,同时,它也会从屏幕的右侧滑动与单击的任务有关的一些详细信息。 This 'detail card' will take the half of the screen too. 该“明细卡”也将占据屏幕的一半。 To summarize, I want to mimic the wunderlist
effect. 总而言之,我想模仿wunderlist
。 So I wrote this fiddle , but it is not working smoothly. 因此,我写了这个小提琴 ,但是工作并不顺利。 Could some one help ? 有人可以帮忙吗?
Give appropriate width,position. 给出适当的宽度,位置。
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<STYLE>
#content {
background-color:#6688ff;
position:absolute;
width:100px;
height:100px;
padding:3px;
margin-top:5px;
left: 100px;
}
</STYLE>
<input type="button" id="left" value="Left"/>
<input type="button" id="right" value="Right"/>
<div id="content">Move</div>
<script>
$(document).ready(function(){
$("#right").click(function() {
$("#content").animate(
{"left": "+=50px"},
"slow");
});
$("#left").click(function() {
$("#content").animate(
{"left": "-=50px"},
"slow");
});
});
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.