if ( window.location.pathname == '/' ) {
var root = document.documentElement;
root.className += ' index';
}
wondow.location.pathname에 지정된 경로의 URL로 접속 할 경우 index라는 class를 html에 추가해준다.
즉, 현재 보고있는 주소가 http://wallel.com/ 일 경우 html class=" index"가 된다.
만약 http://wallel.com/188 에서 사용하려면 window.location.pathname == '/188' 이라고 하면 된다.
index 앞의 스페이스바를 제거할 경우 html class="test index"이렇게 나와야 하는게 html class="textindex" 이렇게 나오니 주의하자.