2013-07-29 81 views

回答

1

尝试使用防止默认

$(".link").click(function(e) { 
     e.preventDefault(); 
     $('.content-container div').fadeOut('slow'); 
     $('#' + $(this).data('rel')).fadeIn('slow'); 
    }); 

here is a DEMO

+0

完美答案! – fightstarr20

1

由于链接包裹在一个标签,你必须公关事件标记的默认行为。 Try:

$(".link").click(function(e) { 
    e.preventDefault(); 
    $('.content-container div').fadeOut('slow'); 
    $('#' + $(this).data('rel')).fadeIn('slow'); 
});