Mercurial > libervia-templates
diff sat_templates/templates/default/static/common.js @ 230:0e69b5843c2f
theme: bulma theme first draft:
This theme uses the Bulma CSS framework, Brython to handle the menu on touch devices, and
Sass to customize Bulma. CSS default fallbacks are disabled as Bulma uses its own naming
conventions, and default fallbacks would lead to hard to debug conflicts.
`common.js` has been slightly improved to handle custom classed in `tab_select`
The theme is not complete yet, but it is functional.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 19 May 2020 00:02:34 +0200 |
parents | cede18c118c9 |
children | 61f3efd69fc3 |
line wrap: on
line diff
--- a/sat_templates/templates/default/static/common.js Sun Apr 26 22:06:07 2020 +0200 +++ b/sat_templates/templates/default/static/common.js Tue May 19 00:02:34 2020 +0200 @@ -65,22 +65,23 @@ ); } -function tab_select(tab_btn_elt, tab_page_id) { +function tab_select(tab_btn_elt, tab_page_id, btn_clicked_cls='state_clicked', tab_clicked_cls='state_clicked') { + for (let elt of document.getElementsByClassName("tab__btn")) { if (elt === tab_btn_elt) { - elt.classList.add('state_clicked'); + elt.classList.add(btn_clicked_cls); } else { - elt.classList.remove('state_clicked'); + elt.classList.remove(btn_clicked_cls); } } let tab_page_elt = document.getElementById(tab_page_id); for (let elt of document.getElementsByClassName("tab__page")) { if (elt === tab_page_elt) { - elt.classList.add('state_clicked'); + elt.classList.add(tab_clicked_cls); } else { - elt.classList.remove('state_clicked'); + elt.classList.remove(tab_clicked_cls); } } }