|
|
|
|
|
by Nadya
3892 days ago
|
|
Structural purposes. Personally, I hate moving/changing/adding classes with Javascript. classList is hacky. Stuff like this is exactly what data-attributes are for. [0] img.dataset.filter // "instagram filter type"
The CSS would need slight changes, accordingly: img[data-filter="filter_type"] { /* styles */ }
[0] https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Usin... |
|
Surely the common setting for this to be applied is in a web page where the author/photographer/designer has already selected a fixed filter and the visitor is just looking at it applied. A UI allowing someone to toggle or select filters on an image is the exceptional case here.