이 함수 또는 mousemove 이벤트를 파괴 할 수 있습니까?이 기능이나 mousemove 이벤트를 파괴 할 수 있습니까?
나는 두통을주고있는 jQuery에 몇 가지 코드가있다. 이 코드는 온라인상에서 mousemove 효과를 위해 요소 위에 지나갈 때 발견되었습니다. 그러나 그를 떠날 때 destuir이 어떻게 이벤트를 보충하거나 삭제할 수 있는지 알고 싶었습니다. 다음과 같이
내가 가지고있는 예는 다음과 같습니다
$("#icons").mouseenter(function(e) {
$(this).find('div').slidemouse();
});
$("#icons").mouseleave(function(e) {
$(this).find('div').slidemouse('destroy');
});
코드 플러그인 :
(function($) {
$.fn.slidemouse=function(options) {
var defaults=
{
height:'240px',
widthExpand:true,
mirror:false,
mirrorOpacity:.3
};
var opts=$.extend(defaults,options);
var expands=1;
var galleryWidth=0;
var self=this;
self.css('overflow','hidden');
self.children().css('height',opts.height);
self.children().children().each(function(index) {
galleryWidth=galleryWidth+$(this).outerWidth(true)
}
);
if(opts.widthExpand) {
while(galleryWidth<self.width()) {
self.children().children(":nth-child("+expands+")").clone().appendTo(self.children());
galleryWidth=galleryWidth+self.children().children(":nth-child("+expands+")").outerWidth(true);
expands++
}
}
self.children().css("width",galleryWidth);
if(opts.mirror) {
self.clone().insertAfter(self).attr("id","");
self.next().fadeTo(0,opts.mirrorOpacity)
}
if(opts.widthExpand||opts.mirror) {
$(window).bind("resize",resizeWindow)
}
function resizeWindow() {
if(opts.widthExpand) {
galleryWidth=0;
self.children().children().each(function(index) {
galleryWidth=galleryWidth+$(this).outerWidth(true)
});
while(galleryWidth<self.width()) {
self.children().children(":nth-child("+expands+")").clone().appendTo(self.children());
galleryWidth=galleryWidth+self.children().children(":nth-child("+expands+")").outerWidth(true);
expands++
}
self.children().css("width",galleryWidth);
if(opts.mirror) {
self.next().remove();
self.clone().insertAfter(self).attr("id","");
self.next().fadeTo(0,opts.mirrorOpacity)
}
}
}
$(this).parent().mousemove(function(e) {
var x=e.pageX-this.offsetLeft;
var calc=(self.children().width()-self.width())/self.width();
var left=x*calc;
var right=(self.width()-x)*calc;
self.stop().animate({scrollLeft: left}, 500);
if(opts.mirror) {
self.next().stop().animate({scrollLeft: right}, 500);
}
})
}
}
)(jQuery);
I :
}
이제로하는 MouseLeave에 새로운 옵션을 사용할 수 있습니다 여기 처음 두 단락이 영어로는 의미가 없기를 두려워합니다. 문제를 조금 더 잘 설명하기 위해 질문을 수정 하시겠습니까? 아니면 단어를 다시 쓸 수 있도록 도와 줄 누군가를 얻으시겠습니까? 현재 문제가 무엇인지는 명확하지 않습니다. – halfer
스페인어로하기 때문에 내 영어를 변명하면 –