$(".built-in-lnb a").on('click', function(event) {
if (this.hash !== "") {
event.preventDefault();
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 600, function(){
window.location.hash = hash;
});
}
});
.href -> the entire of a url
.hostname -> the hostname of a url (도메인 이름 또는 url 의 ip 주소를 나타내는 문자열)
.host -> the hostname and port number of a url
.hash -> hash 속성은 해시 기호(#)를 포함하여 url의 앵커부분을 설정 혹은 반환
'프로그래밍 예제 > 예제' 카테고리의 다른 글
특정영역에 스크롤 넘으면 클래스 추가 (0) | 2019.05.22 |
---|---|
브라우저 창에 따라 클래스 변화시키기 (0) | 2019.05.03 |
userAgent를 사용하여, 사용자 브라우저 확인하기 (0) | 2019.02.25 |
스크롤 작동 중 내리는 스크롤과 올리는 스크롤 구분하기 자바스크립트 (0) | 2019.02.25 |
클릭하면 지정해둔 위치로 스크롤 이동(스크롤 변경) (0) | 2019.02.20 |