Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/mq4-hover-shim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Rebert <github@rebertia.com>2015-01-10 01:59:11 +0300
committerChris Rebert <github@rebertia.com>2015-01-10 01:59:11 +0300
commit0a671776d41b551d13d7e552f92c87a788f14e2d (patch)
treed508bf251910e73db9b0596b1dde0b123b4d448a /README.md
parentc51a816299dd383b0c96474c46ac538f5afb3b84 (diff)
README: update client-side usage example
Diffstat (limited to 'README.md')
-rw-r--r--README.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/README.md b/README.md
index b64b606..13eace3 100644
--- a/README.md
+++ b/README.md
@@ -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.