jquery 이벤트

Javascript&Jquery 2012. 3. 22. 23:14
1. $(selector).bind(eventName, function(event){ })
2. $(selector).bind(object) 

 여러 메소드 들...

blur, resize, mousedown, mouseenter, keydown, focus, scroll, mouseup,mouseleave, keypress, focusin, unload, mousemove, change, keyup, focuseout, click, mouseover,select, error, load, dbclick, mouseout, submit, ready


간단한 방식
$(selector).method(function(event) {}); 


toggle() : click 이벤트를 여러 이벤트 핸들러를 번갈아 가며 실행할 수 있게 연결
hover() : mouseenter 이벤트와 mouseleave 이벤트를 동시에 연결


문법
$(selector).toggle(function(event) {}, ...., function(event) {});
$(selector).hover(function(event) {}, function(event) {});


unbind()
1. $(selector).unbind()  : 해당객체관련 모든 이벤트 제거
2. $(selector).unbind(eventName)  : 문서객체의 특정 이벤트와 관련된 모든 이벤트 제거
3. $(selector).unbind(eventName, function)  : 특정이벤트 핸들러 제거
 

jquery 이벤트 객체의 속성
event.pageX : 브라우저의 화면을 기준으로 한 마우스 X좌표 위치
event.pageY : 브라우저의 화면을 기준으로 한 마우스의 Y좌표 위치
event.preventDefault() : 기본이벤트를 제거
event.stopPropagation() : 이벤트 전달을 제거 

'Javascript&Jquery' 카테고리의 다른 글

이벤트 통합 메서드  (0) 2012.03.25
stopPropagation()  (0) 2012.03.25
jquery 문서객체 삽입 매서드  (0) 2012.03.22
attr()/removeClass()/removeAttr()/$(selector)....  (0) 2012.03.21
jQuery 속성 선택자  (0) 2012.03.19
posted by 알 수 없는 사용자