본문 바로가기

[ programing ]/JavaScript + JQuery

jQuery 이벤트타입명으로 메서드 호출


  • bind() : 하나의 엘리먼트에 여러가지 이벤트를 생성 하는 경우 유리


box.bind({

},

mouseout:function(){

var target $(this); 

target.removeClass().addClass('mouseout');

target.find('> p').text('mouseout  이벤트 발생');

},

mousedown:function(){

var target $(this);

target.removeClass().addClass('mousedown');

target.find('> p').text('mousedown  이벤트 발생');

},

mouseup:function(){

var target $(this); 

target.removeClass().addClass('mouseup');

target.find('> p').text('mouseup  이벤트 발생');

}

});






  • 이벤트타입명으로 메서드를 호출


box.mouseover:function(){


var target $(this); 

target.removeClass().addClass('over');

target.find('> p').text('mouseout  이벤트 발생');

});