Mercurial > libervia-templates
comparison default/static/css.js @ 15:c319291943be
static: css.js (library for basic style manipulation) first draft
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 04 May 2017 00:55:06 +0200 |
parents | |
children | 494d740aa3d6 |
comparison
equal
deleted
inserted
replaced
14:9a77174abc1e | 15:c319291943be |
---|---|
1 function set_clicked_class_tag(tag_name, class_name='clicked') { | |
2 for (let elt of document.getElementsByTagName(tag_name)) { | |
3 elt.classList.toggle(class_name); | |
4 } | |
5 } | |
6 | |
7 function set_clicked_class_id(trigger_elem_id, target_elem_id=null, class_name='clicked') { | |
8 if (target_elem_id === null) { target_elem_id = trigger_elem_id; } | |
9 document.getElementById(trigger_elem_id).addEventListener( | |
10 "click", | |
11 function() { | |
12 document.getElementById(target_elem_id).classList.toggle(class_name); | |
13 } | |
14 ); | |
15 } |