1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

allow to add an url tab button

This commit is contained in:
andreas
2024-10-13 17:12:10 +02:00
parent 47973b6bcf
commit 795117b6f4
4 changed files with 17 additions and 3 deletions

View File

@@ -223,6 +223,7 @@ body {
}
#tabs {
display: flex;
flex-wrap: wrap;
border-bottom: 1px solid grey;
margin-bottom: 0.5em;
}

View File

@@ -1944,13 +1944,17 @@
reader.readAsArrayBuffer(slice);
});
}
function addTabPage(name,label){
function addTabPage(name,label,url){
if (label === undefined) label=name;
let tab=addEl('div','tab','#tabs',label);
tab.setAttribute('data-page',name);
tab.addEventListener('click',function(ev){
handleTab(ev.target);
})
if (url !== undefined){
tab.setAttribute('data-url',url);
return;
}
tab.setAttribute('data-page',name);
let page=addEl('div','tabPage hidden','#tabPages');
page.setAttribute('id',name);
return page;