로 요소를 이동할 수 있습니다 어떻게 4 개 개의 버튼 중 하나를 클릭에 DIV를 이동해야합니다. 내가 자바 스크립트
각 버튼 사업부를 이동하는 함수를 호출하는 이벤트 리스너를 가지고 볼 수 있듯이
function left(){
$("#rstSearch").position().left = $("#rstSearch").position().left + 10;
}
function right(){
$("#rstSearch").position().right = $("#rstSearch").position().right + 10;
}
function top2(){
$("#rstSearch").position().top = $("#rstSearch").position().top + 10;
}
function bottom(){
$("#rstSearch").position().bottom = $("#rstSearch").position().bottom + 10;
}
#rstSearch {
background-color: blue;
width:50px;
height:50px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button type="button" id="btnLeft" onclick="left();" class="button_air-medium"> left</button> \t \t
<button type="button" id="btnRight" onclick="right();" class="button_air-medium">right</button>
<button type="button" id="btnTop" onclick="top2();" class="button_air-medium">top</button>
<button type="button" id="btnBottom" onclick="bottom();" class="button_air-medium">bottom</button>
<div id="rstSearch" class="exosphere" ></div>
그러나 이것은 작동하지 않습니다. 변경하려면 어떻게해야합니까? 작은
이것은 당신이 https://jsfiddle.net/o2gxgz9r/14495/을 원하는 무엇인가? –