[js] 특정 주소에서 html 에 class 추가하기
if ( window.location.pathname == '/' ) { var root = document.documentElement; root.className += ' index'; } wondow.location.pathname에 지정된 경로의 URL로 접속 할 경우 index라는 class를 html에...
if ( window.location.pathname == '/' ) { var root = document.documentElement; root.className += ' index'; } wondow.location.pathname에 지정된 경로의 URL로 접속 할 경우 index라는 class를 html에...
jQuery의 attr() 속성을 사용하면, 특정 소스가 가진 값을 뽑아올 수 있다. 아래 예제를 참고해보자. <img src="http://abc.com/original.png" alt="original image" id="original-image"> <img src="h...
CSS #sidebar { font-size: 14px; z-index: 100; -webkit-transform: translate3d(-300px,0,0); -moz-transform: translate3d(-300px,0,0); transform: translate3d(-300px,0,0); -webkit-transition: all ...
화면 중앙에 div를 놓고싶을 때 사용.width, height 값이 반드시 필요하니 주의 .center { position: absolute; margin: auto; top: 0; right: 0; bottom: 0; left: 0; width: 100px; height: 100px; } &l...
클릭해서 보여주고, 다시 클릭하면 숨기는게 가능한 간단하지만 유용한 자바스크립트 토글 소스. SCRIPT function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'bl...
화면 드래그 색상을 변경해준다. IE9부터 지원하니 다양하게 활용할 수 있겠다. 코드 ::-moz-selection { color: #fff; background-color: #888; } ::selection { color: #fff; background-color: #888; }