如果div是隐藏的,我试图根据隐藏/显示功能.我的代码看起来像这样:
//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');
}
});
});
//
Run Code Online (Sandbox Code Playgroud)
*更新*
这有效:
//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');
}
});
});
//
Run Code Online (Sandbox Code Playgroud)
但由于某种原因,它不会改变文本.它滑动得很好.怎么会?
可能试试这个
$('.postBoxShowAll').click(function() {
$('.postBoxContent').slideToggle('fast', function() {
if ($('.postBoxContent').is(':hidden')) {
$('.postBoxShowAll').html('Show all');
} else {
$('.postBoxShowAll').html('Hide all');
}
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10432 次 |
| 最近记录: |