"CSS 이동"의 두 판 사이의 차이

 
(같은 사용자의 중간 판 3개는 보이지 않습니다)
1번째 줄: 1번째 줄:
;CSS 이동 구현
;CSS 이동 구현


==예시 1==
==예시 1: 마우스오버로 동작==
<source lang='html'>
<source lang='html'>
<style>
<style>
18번째 줄: 18번째 줄:
<div class='box1'></div>
<div class='box1'></div>
</source>
</source>
<jsfiddle height='250'>s9pnL9mm</jsfiddle>


==예시 2: 버튼 동작==
==예시 2: 버튼 클릭으로 동작==
<source lang='html'>
<source lang='html'>
<style>
<style>
28번째 줄: 29번째 줄:
   background: red;
   background: red;
   transition: 1.5s;
   transition: 1.5s;
}
.box1:hover {
  left: 300px;
}
}
</style>
</style>

2017년 1월 8일 (일) 14:52 기준 최신판

CSS 이동 구현

1 예시 1: 마우스오버로 동작[ | ]

<style>
.box1 {
  position: absolute;
  left: 0;
  width: 150px; height: 150px;
  background: red;
  transition: 1.5s;
}
.box1:hover {
  left: 300px;
}
</style>

<div class='box1'></div>

2 예시 2: 버튼 클릭으로 동작[ | ]

<style>
.box1 {
  position: absolute;
  left: 0;
  width: 150px; height: 150px;
  background: red;
  transition: 1.5s;
}
</style>

<button id='btn-move'>박스 이동</button>
<div class='box1'></div>

<script src="//code.jquery.com/jquery.min.js"></script>
<script>
$(function() {
  $("#btn-move").click(function() {
    $(".box1").css('left', '300px');
  });
});
</script>

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}