有没有办法缩短这个感觉就像我在重复代码,看起来很不整洁?重复的代码
jQuery(document).ready(function() {
$('.allText').hide();
$('#b1').click(function() {
$('.allText').hide();
$('#text1').fadeIn(800);
});
$('#b2').click(function() {
$('.allText').hide();
$('#text2').fadeIn(800);
});
$('#b3').click(function() {
$('.allText').hide();
$('#text3').fadeIn(800);
});
$('#b4').click(function() {
$('.allText').hide();
$('#text4').fadeIn(800);
});
$('#b5').click(function() {
$('.allText').hide();
$('#text5').fadeIn(800);
});
$('#b6').click(function() {
$('.allText').hide();
$('#text6').fadeIn(800);
});
$('#b7').click(function() {
$('.allText').hide();
$('#text7').fadeIn(800);
});
});
你能分享相应的标记? – aletrasg 2013-03-05 15:45:05