jquery problem: callback is fired for each selector (ie 3 selectors, fired three times)
This fires the callback twice:
$('#get_started, #favour').fadeOut(300, function(){
$('#wrap_right').data('first_click_made', true);
setup_tab_1(id);
load_fb_js();
});
this doesn't but is it the best way to fix the problem?
$('#wrap_right #favour').fadeOut(300);
$('#get_started').fadeOut(300, function(){
$('#wrap_right').data('first_click_made', tr开发者_运维知识库ue);
setup_tab_1(id);
load_fb_js();
});
An alternative:
$('#get_started, #favour').fadeOut(300, function(){
if (this.id === 'get_started')
{
$('#wrap_right').data('first_click_made', true);
setup_tab_1(id);
load_fb_js();
}
});
精彩评论