npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@financial-times/o-hoverable

v3.2.1

Published

_Deprecated. We recommend the [hover](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/hover) or [any-hover](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/any-hover) media query instead._

Downloads

9

Readme

Origami hover effects Build Status MIT licensed

Deprecated. We recommend the hover or any-hover media query instead.

Helper to activate hover states only on devices that support them, preventing unintended hover effects from happening on touch devices.

Usage

Add this class to the document to enable hover effects:

<!-- This class gets removed on touch devices -->
<html class="o-hoverable-on">

Why o-hoverable?

It's common for interactive elements on web pages to have hover effects, either via JavaScript mouse* events, or via CSS :hover pseudoclasses. However, while some users will be interacting with your web page using a mouse, others may be using a touch screen. Since touch screens typically don't have a 'hover' capability, hover effects are usually undesirable.

In fact, some touch devices may have 'emulated hover', where the first touch activates a hover effect and the second is treated as a click. This is a way for the browser to provide a way to use pages that 'require' hover (e.g. to select a flyout menu option) but this is also usually undesirable if you design your site sensibly.

This module provides for all Origami hover effects to be turned on and off, and provides a JavaScript utility to do so intelligently based on the input devices available to the user.

Sass

Component developers must prefix :hover states with $o-hoverable-if-hover-enabled, allowing hover effects to be configured by this module:

@import 'o-hoverable/main';

#{$o-hoverable-if-hover-enabled} .o-mymodule-button:hover {
	// Paint it black when hover is supported
	background: black;
}

Compiles to:

.o-hoverable-on .o-mymodule-button:hover {
	background: black;
}

JavaScript

Component developers must load hover effects conditionnally:

function showMyMenuOnHover() {
	if (!require('o-hoverable').isHoverEnabled()) {
		// Hover isn't supported: don't do anything
		return;
	}
	// Hover is supported: show a menu
}

Configuring the class

If you want to change the class used to trigger hover effects, you can do so by redefining the $o-hoverable-if-hover-enabled variable before importing this module's Sass.

$o-hoverable-if-hover-enabled: '.do-that-hover-thang';

And calling setClassName on the JavaScript module:

require('o-hoverable').setClassName('do-that-hover-thang');

Disabling o-hoverable

Restore hover effects on all devices (even touch devices):

$o-hoverable-if-hover-enabled: '';
@import 'o-hoverable/main';

#{$o-hoverable-if-hover-enabled} .o-mymodule-button:hover {
	// Paint it black
	background: black;
}

Compiles to:

.o-mymodule-button:hover {
	background: black;
}

Contact

If you have any questions or comments about this component, or need help using it, please either raise an issue, visit #ft-origami or email Origami Support.


Licence

This software is published by the Financial Times under the MIT licence.