0
return this.each(function(){
$(this).mouseenter(s,function(){
s.self = $(this);
s.slot = $(this).attr('id').split('_')[1];
s.callback = function(o){
var s = {}
$.extend(s,o);
/* Ajax call, to get banner info data */
s.ajax = $.getJSON(domain+lng+'/banner/countbanners?slot='+s.slot,function(data){
s.template = $.tmpl(s.name,$.extend(data,{
slot_width:s.self.width(),
slot_height:s.self.height(),
view_href:s.view_href+s.slot
}));
s.template.appendTo(s.self);
});
}
$.get_template(s);
});
$(this).mouseleave(s,function(o){
s.self.find('.banner_info_wr').remove();
});
});
어떻게 mouseleave에서 s.ajax 객체에 액세스 할 수 있습니까?jQuery 콜백에서 일부 객체에 액세스
콜백은 템플릿을 얻은 후에 get_template 함수 내부에서 호출됩니다.
감사)
주세요. 작동하지 않습니다. | – Somebody
mouseleave에서 액세스하려고하면 정의되지 않습니다. Ajax 호출 바로 뒤에 콜백 내에서 mouseout을 재 바인드했습니다. – Somebody