diff options
author | Chris Rebert <github@rebertia.com> | 2015-01-10 01:59:11 +0300 |
---|---|---|
committer | Chris Rebert <github@rebertia.com> | 2015-01-10 01:59:11 +0300 |
commit | 0a671776d41b551d13d7e552f92c87a788f14e2d (patch) | |
tree | d508bf251910e73db9b0596b1dde0b123b4d448a /README.md | |
parent | c51a816299dd383b0c96474c46ac538f5afb3b84 (diff) |
README: update client-side usage example
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -28,11 +28,11 @@ some-prefix some-selector { } ``` (In normal use-cases, `some-selector` will contain the `:hover` pseudo-class and `some-prefix` will be a specially-named CSS class that will typically be added to the `<html>` element.) -* A client-side JavaScript library that detects whether the user-agent truly supports hovering. If the check returns true, then your code can add the special CSS class to the appropriate element to enable [`:hover`](hover-pseudo) styles; for example: +* A client-side JavaScript library that detects whether the user-agent truly supports hovering. When the check returns true, then your code can add the special CSS class to the appropriate element to enable [`:hover`](hover-pseudo) styles; for example: ```js -if (mq4HoverShim.supportsTrueHover()) { - document.documentElement.className += ' some-special-class'; -} +$(document).on('mq4hsChange', function (e) { + $(document.documentElement).toggleClass('some-special-class', e.trueHover); +}); ``` Obviously, this requires JavaScript to be enabled in the browser, and would default to disabling `:hover` styles when JavaScript is disabled. |