如果div是隐藏的,我试图根据隐藏/显示功能.我的代码看起来像这样: //postInbox/outbox/savedbox show all/hide all$('.postBoxShowAll').click(function(){ $('.postBoxContent').slideToggle('fast', function(){ if($(this).i
//postInbox/outbox/savedbox show all/hide all
$('.postBoxShowAll').click(function(){
$('.postBoxContent').slideToggle('fast', function(){
if($(this).is(':hidden')){
$('.postBoxShowAll').html('Show all');
}else{
$('.postBoxShowAll').html('Hide all');
}
});
});
//
*更新*
这有效:
//postInbox/outbox/savedbox show all/hide all
$('.postBoxShowAll').click(function(){
$('.postBoxContent').slideToggle('fast', function(){
if($('.postBoxContent').is(':visible')){
$('.postBoxShowAll').html('Hide all');
}else{
$('.postBoxShowAll').html('Show all');
}
});
});
//
但由于某种原因,它不会改变文本.它滑动得很好.怎么会?
可能试试这个$('.postBoxShowAll').click(function() {
$('.postBoxContent').slideToggle('fast', function() {
if ($('.postBoxContent').is(':hidden')) {
$('.postBoxShowAll').html('Show all');
} else {
$('.postBoxShowAll').html('Hide all');
}
});
});
