Skip to content

Instantly share code, notes, and snippets.

View peisenmann's full-sized avatar

Patrick peisenmann

View GitHub Profile
@peisenmann
peisenmann / Readme.md
Last active March 6, 2016 17:07 — forked from jdanyow/app.html
hover-color Aurelia custom attribute

The important things to note in this gist are:

app.html The usage of the custom attribute hover-color is <div hover-color="special-hover-class"> where special-hover-class is simply a css class that will be applied to all hover-color elements when the given element is hovered.

hover-color.js This is the source code of the custom attribute itself, and is commented to explain what it does. Essentially, if the element is hovered, the custom attribute sends out a message to tell all other hover color elements to change. When the mouse leaves the element, a message is broadcast to tell them all to remove their class change.