두 개의 버튼으로 div를 만들려고합니다. 첫 번째 버튼을 클릭하면 노틸러스 div가 왼쪽에서 슬라이드됩니다. 단추를 클릭하면 화면에서 뒤로 슬라이드됩니다. 메인 div의 두 번째 버튼과 동일합니다. 두 번째 버튼을 클릭 할 때 div가 오른쪽에서 슬라이드됩니다. 다시 스크린에서 뒤로 슬라이드시키는 버튼이 있습니다.jquery로 div에서 슬라이드 만들기
이것은 모두 jquery에서 완료됩니다.
아무도 나에게 무슨 문제가 있다고 말할 수 있습니까?
JQuery와 :
var boxWidth = $("#port2").width();
$('#left').on('click',function(){
$('#port1').animate({left:'8'});
});
$('#right').on('click',function(){
$('#port2').animate({(right:'100%'-boxWidth});
})
$('#leftC').on('click',function(){
$('#port1').animate({right:'100%'});
});
$('#rightC').on('click',function(){
$('#port2').animate({left:'100%'});
});
HTML :
<div id="wrapper">
<div id="port1">
Left text goes here
<button id='leftC'>Close 1</button>
</div>
<div id="port2">
Right text goes here
<button id='rightC'>Close</button>
</div>
<div id="text">
good stuff goes here
<br />
<button id='left'>Left</button>
<br />
<button id='right'>Right</button>
</div>
</div>
CSS
#text{
width:500px;
height:200px;
background-color:red;
font-weight:bold;
font-size:1.2em;
padding:25px;
}
#text button{
margin: 20px 0px 10px;
}
#port1{
width:500px;
height:200px;
background-color:green;
font-weight:bold;
font-size:1.2em;
padding:25px;
position:absolute;
left:-100%
}
#port2{
width:500px;
height:200px;
background-color:yellow;
font-weight:bold;
font-size:1.2em;
padding:25px;
position:absolute;
right:-100%;
}
현재 작업에서 볼 수 있습니다 http://jsfiddle.net/belotte/vmu59h87/19/
감사합니다