Mercurial > libervia-templates
comparison default/static/css.js @ 29:494d740aa3d6
static/css.js: added clicked_cls function:
this function toggle "clicked" class on each click, and remove "init" class on first click. Useful to make CSS react easily on clicks.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 24 Jun 2017 20:25:39 +0200 |
parents | c319291943be |
children | e296ee56f611 |
comparison
equal
deleted
inserted
replaced
28:4bf00291b895 | 29:494d740aa3d6 |
---|---|
11 function() { | 11 function() { |
12 document.getElementById(target_elem_id).classList.toggle(class_name); | 12 document.getElementById(target_elem_id).classList.toggle(class_name); |
13 } | 13 } |
14 ); | 14 ); |
15 } | 15 } |
16 | |
17 function clicked_cls(elt) { | |
18 /* toggle "clicked" class on each click, and remove "init" class if present */ | |
19 // init | |
20 if (elt.classList.contains("init")) { | |
21 elt.classList.remove("init"); | |
22 } | |
23 | |
24 // clicked | |
25 elt.classList.toggle("clicked"); | |
26 } |