Web/jQuery
로딩 테크닉
kimtaku
2015. 7. 15. 14:09
우선 로딩클래스를 만들고 html 문서에 기본으로 설정한다.
그리고 보통 html문서가 로딩되고 난 뒤, 스크립트가 로딩되는데 이 때 로딩클래스를 제거한다.
AJAX를 사용하는 경우
$body = $("body");
$(document).on({
ajaxStart: function() { $body.addClass("loading"); },
ajaxStop: function() { $body.removeClass("loading"); }
});
를 참고한다. (ajaxStart, ajaxStop을 사용한다.)