-
$(function(){}) vs window.onload컴퓨터/jQuery 2020. 2. 9. 14:03
1) $(function() {})
$(document).ready(function(){});
페이지가 로딩되었을 때 일어나길 바라는 이벤트들이 작성된다.
리소스와 상관없이 DOM만 생성되어도 호출된다.
예를 들어 이미지 같은 리소스를 요구하는 페이지일 경우 이미지 로딩 완료 상관없이 진행
2) window.onload = function() {};
리소스 호출도 완료되었을 경우 실행
'컴퓨터 > jQuery' 카테고리의 다른 글
[jQuery] each function(for 대신 $(대상이 되는 selector).each) (0) 2020.02.04 [jQuery mobile] 설정 (0) 2020.01.29 [jquery mobile] toolbar (0) 2020.01.29 [jquery mobile] 컴포넌트, page, 멀티페이지 템플릿, dialog (0) 2020.01.29 [jquery mobile] 01 (0) 2020.01.29