show header buttons conditionally

This commit is contained in:
Jakob Ketterl
2021-01-16 18:06:37 +01:00
parent 9f702f5d14
commit 13215960c4
2 changed files with 11 additions and 1 deletions

View File

@ -1,7 +1,12 @@
function Header(el) {
this.el = el;
this.el.find('#openwebrx-main-buttons').find('[data-toggle-panel]').click(function () {
var $buttons = this.el.find('#openwebrx-main-buttons').find('[data-toggle-panel]').filter(function(){
// ignore buttons when the corresponding panel is not in the DOM
return $('#' + $(this).data('toggle-panel'))[0];
});
$buttons.css({display: 'block'}).click(function () {
toggle_panel($(this).data('toggle-panel'));
});