diff --git a/README.md b/README.md index 930f030..8b88d21 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ extending the **very basic** `` native browser component, in * Cursor for hover & grabbing * *RTL* (right-to-left) support via `dir=rtl` attribute * Value is printed by default at all times +* Value supports *prefix* and/or *suffix* * Minimum & maximum values are printed at the edges * Ticks are printed on each step, or every N step * Ticks automatically hidden if too many (too dense to be helpful) @@ -54,6 +55,9 @@ extending the **very basic** `` native browser component, in In addition to all the root variables, a helper variable `--is-left-most` exists on the `` element itself, which can be helpful if it is desirable to visually distingush between left/right thumbs of a multi-range slider. +⚠️`--min` & `--max` variables' values should be kept as *integers* (not *floating-point*) because a [CSS trick](https://stackoverflow.com/a/40179718/104380) +using counters is used to print the values in a pseudo-element, and it only works for integers. + --- I must say that CSS is not yet good enough to make this code much cleaner. I had to rely on repeating the input's attributes in its parent node, as CSS style variables, because CSS is currently unable to [extrapolate attibutes as variables](https://github.com/w3c/csswg-drafts/issues/4482). @@ -96,7 +100,7 @@ For the SCSS version, use this path: ### Markup Example (single range): ```html -
+
@@ -106,7 +110,7 @@ For the SCSS version, use this path: ### Markup Example (double range): ```html -
+
diff --git a/ui-range.scss b/ui-range.scss index b6d17a3..a5b6980 100644 --- a/ui-range.scss +++ b/ui-range.scss @@ -229,7 +229,7 @@ --value: var(--value-a); --x-offset: calc(var(--completed-a) * -1%); - &::after { content: var(--text-value-a) } + &::after { content: var(--prefix, '')var(--text-value-a)var(--suffix, ''); } } } @@ -263,7 +263,7 @@ transition: all .12s ease-out, left 0s; &::after { - content: var(--text-value-b); + content: var(--prefix, '')var(--text-value-b)var(--suffix, ''); font: var(--value-font); } }