是否可以在三个对象(image,buttonOne,buttonTwo)上运行相同的mouseover和mouseout事件,而重复的代码更少?
image.mouseover(function(){
buttonOne.addClass('className');
buttonTwo.addClass('className');
}).mouseout(function(){
buttonOne.removeClass('className');
buttonTwo.removeClass('className');
});
buttonOne.mouseover(function(){
buttonOne.addClass('className');
buttonTwo.addClass('className');
}).mouseout(function(){
buttonOne.removeClass('className');
buttonTwo.removeClass('className');
});
buttonTwo.mouseover(function(){
buttonOne.addClass('className');
buttonTwo.addClass('className');
}).mouseout(function(){
buttonOne.removeClass('className');
buttonTwo.removeClass('className');
});