Home > Designing, Others > The Power of Changing Classes

The Power of Changing Classes

December 1st, 2016 Leave a comment Go to comments

People responded quite positively to “Hey designers, if you only know one thing about JavaScript, this is what I would recommend.” Even the YouTube comments were positive.

Hey designers, if you only know one thing about JavaScript, this is what I would recommendhttps://t.co/X4DKhGzze3

(Video + Article)

— Chris Coyier (@chriscoyier) November 23, 2016

Benjamin De Cock mentioned that not only does he agree changing classes is the most important thing a web design can know how to do in JavaScript, he built a mini library around that idea:

@chriscoyier 100% agree — this is exactly why I made https://t.co/txfQnMfpbx, it does exclusively that.

— Benjamin De Cock (@bdc) November 23, 2016

It has a really unusual way of configuring it. You use plain language, within a tag, to tell it what classes to change on click, like:

clicking on "h1" removes class "open" on "h1.open"
clicking on "h1" adds class "open" on "target"

Here's a fork of the "level up" demo from that video, done with uilang instead:

See the Pen Change Classes on Stuff by Chris Coyier (@chriscoyier) on CodePen.

Pretty cool.

I'd stick to my sentiment as well though. If you're looking to baby step yourself into JavaScript, learning to select things and changes classes without any library help at all is a great way to do that.


The Power of Changing Classes is a post from CSS-Tricks

Categories: Designing, Others Tags:
  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.