0
그것은 이상한패스 인수
var animateFunction = function (i) {
if (animBool) {
Fn.slideData(values(i)); // To fetch some data
util.animate.tweenAnimate(sliderWrapper, 0 , Math.ceil("-"+sliderWidth));
animBool = 0;
} else {
util.animate.tweenAnimate(sliderWrapper, Math.ceil("-"+sliderWidth) ,0);
animBool = 1;
}
};
for (i = 0; i < annotateArray.length; i++) {
//To Remember the state of value "i"
(function (i) {
//Custom Event Listener for fallback for IE
util.addEvent(annotateArray[i], "click", animateFunction(i), true);
}(i));
}
for (i = 0; i < annotateArray.length; i++) {
//Custom Remove Event Listener for fallback for IE
util.removeEvent(annotateArray[i], "click", animateFunction);
}
//Custom Bind Event Method
util.addEvent = function (obj, evt, callback, capture) {
if (window.attachEvent) {
obj.attachEvent("on" + evt, callback);
} else {
if (!capture) {
capture = false;
}
obj.addEventListener(evt, callback, capture);
}
};
내가 모든 요소에 동적으로 이벤트를 결합하려고하지만 혹 내가이 기능은 '아무튼 요소를 클릭 동작 예상대로 동작하지 않습니다.
,하지만 난 참조 콜백 함수를 통과 한 이유는 ... u는 그럼 당신은 배열을 만들 수 있습니다 편집 코드 –
의 조각을 확인 할 수있는 ... 그것도 이벤트를 바인딩을 해제해야합니다 그것은해야한다 ('function {) {animateFunction (i)} '과 같은) 모든 핸들러에 대한 참조를 저장합니다. 나중에 배열의 참조를 사용하여 바인딩을 해제 할 수 있습니다. – bfavaretto
Thanks mate :) 마침내 배열을 만들고 모든 핸들러에 대한 참조를 저장해야했습니다. –