3
我有代码看起来像这样:更好的方式来写一个reptitive功能?
$('.item-one').mouseover(function() {
$('.img-one').addClass('fit-img');
});
$('.item-two').mouseenter(function() {
$('.img-two').addClass('fit-img');
});
$('.item-three').mouseenter(function() {
$('.img-three').addClass('fit-img');
});
有没有更好的方式来写一样的东西,即使它的工作原理上面?
不要for循环为这些事情的工作? –
你可以显示Item-one/two/three和Img-one/two/three的HTML吗? –
你有'mouseover'和'mouseenter'的混合物 - 那是故意的吗? –