"JQuery .offset()"의 두 판 사이의 차이

잔글 (Jmnote 사용자가 Offset() 문서를 JQuery .offset() 문서로 옮겼습니다)
잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
(사용자 2명의 중간 판 2개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
;jQuery .offset()
;jQuery .offset()
 
* 좌표를 얻거나 설정하는 jQuery 함수


==예시 1==
==예시 1==
<source lang='html5'>
<syntaxhighlight lang='html5'>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>


13번째 줄: 13번째 줄:
console.log( $('#box2').offset() );
console.log( $('#box2').offset() );
</script>
</script>
</source>
</syntaxhighlight>
<jsbin>hivoce</jsbin>
<jsbin>hivoce</jsbin>


==예시 2==
==예시 2==
<source lang='html5'>
<syntaxhighlight lang='html5'>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>


26번째 줄: 26번째 줄:
$('#box2').offset({ top: 0, left: 0 })
$('#box2').offset({ top: 0, left: 0 })
</script>
</script>
</source>
</syntaxhighlight>
<jsbin>sorecu</jsbin>
<jsbin>sorecu</jsbin>


==참고 자료==
==참고==
*http://api.jquery.com/offset/
*http://api.jquery.com/offset/


[[분류: jQuery]]
[[분류: jQuery]]

2020년 11월 2일 (월) 02:53 기준 최신판

1 개요[ | ]

jQuery .offset()
  • 좌표를 얻거나 설정하는 jQuery 함수

2 예시 1[ | ]

<script src="https://code.jquery.com/jquery-1.10.2.js"></script>

<div>안녕</div>
<div id='box2'>친구들</div>

<script>
console.log( $('#box2').offset() );
</script>


3 예시 2[ | ]

<script src="https://code.jquery.com/jquery-1.10.2.js"></script>

<div>안녕</div>
<div id='box2'>친구들</div>

<script>
$('#box2').offset({ top: 0, left: 0 })
</script>


4 참고[ | ]

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