Sometimes I build card-like user interfaces that allow users to select from a group of "cards." The visual state of a selected "card" should change once selected. The Oracle JET oj-panel
, oj-margin
, and oj-selected
utility classes are great for this type of experience. The oj-panel
and oj-margin
classes setup the cards according to the Alta UI design patterns and oj-selected
changes the appearance upon selection. Toggling oj-selected
with a click binding is trivial with jQuery.toggleClass().
Out of the box, the oj-selected
visual changes are either on or off. There are no transition states. I like user interface changes to morph between states. With just a couple of lines of CSS, we can animate what happens to an oj-panel
when oj-selected
is added to the panel:
.oj-panel { cursor: pointer; transition: border-color .3s ease-in-out; }
Here is the jsFiddle
Is the fade effect too subtle for you? Take a look at this CodePen for some impressive animation examples.
No comments:
Post a Comment