카드 목록을 쓰고 있습니다.
카드 목록의 li 요소에는 mouseenter와 mouseleave 이벤트가 있습니다. 빠르게 두 요소 사이에 교환, 리튬 요소가 이상한 행동으로 여기
중복 jquery mouseover 이벤트
mouseenterCard: function(index) {
var nOnRight = index+2;
var n = index+1;
if (n!=1) {
$('#cards-list li:nth-child('+n.toString()+')').animate({'margin-left': '30px'},
"fast",
function() {
});
}
$('#cards-list li:nth-child('+nOnRight.toString()+')').animate({'margin-left': '30px'},
"fast");
},
mouseleaveCard: function(index) {
var nOnRight = index+2;
var n = index+1;
if (n!=1) {
$('#cards-list li:nth-child('+n.toString()+')').animate({'margin-left': marginLeft.toString()+'px'},
"fast",
function() {
});
}
$('#cards-list li:nth-child('+nOnRight.toString()+')').animate({'margin-left': marginLeft.toString()+'px'},
"fast");
}
$('#cards-list').on('mouseenter', 'li' ,function(e){
CardList.getInstance().mouseenterCard($(this).index());
});
$('#cards-list').on('mouseleave', 'li' ,function(e){
CardList.getInstance().mouseleaveCard($(this).index());
});
는 DEMO
입니다.
무엇이 문제입니까?