Can these two jQuery functions be combined into one that is more efficient?

NaO*_*aOH 0 html jquery

I have two functions in jQuery to hide and then show a header, and also swap the buttons out so that when the header is hidden, the "show header" button appears, and vice versa. They are as follows:

$('#close_header').click(function() {
    $('#header').animate({ top: '-=150px' }, 500);
    $(this).toggle();
    $('#open_header').toggle();
});

$('#open_header').click(function() {
    $('#header').animate({ top: '+=150px' }, 500);
    $(this).toggle();
    $('#close_header').toggle();
});
Run Code Online (Sandbox Code Playgroud)

The markup to go along with is as follows:

<img src="images/close.png" id="close_header" class="header_control fadein button">
<img src="images/open.png" id="open_header" class="header_control fadein button">
<div id="header">
    *Header content.*
</div>
Run Code Online (Sandbox Code Playgroud)

有没有办法将这两个功能合并为一个整洁和效率的缘故?

gdo*_*ica 5

绝对没有性能差异.

如果您尝试在一个带参数的函数中编写它,那么它的可读性就会降低.

保持这种状态,没关系.

现在回答你的问题:

有没有办法将这两个功能结合起来......

有没有办法将这两个功能合并为一个整洁和效率的缘故?

不.阅读其他答案中的代码,它们更整洁吗?他们更有效率吗?没有