Skip to content
This repository has been archived by the owner. It is now read-only.
jQuery plugin that creates the basic interactivity for a flyout that opens on hover of trigger element
JavaScript
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
.eslintrc
.gitignore
.npmignore
.npmrc
.travis.yml
LICENSE.md
README.md
browser.json
jquery.hoverflyout.js
jquery.hoverflyout.min.js
karma.conf.js
package.json
test.js
yarn.lock

README.md

jquery-hover-flyout

Build Status Coverage Status Dependency status devDependency status

jQuery plugin that creates the basic interactivity for a flyout that opens on hover of trigger element

$(selector).hoverFlyout();

Experimental

This plugin is still in an experimental state, until it reaches v1.0.0 you must consider all minor releases as breaking changes. Patch releases may introduce new features, but will be backwards compatible.

Install

npm install jquery-hover-flyout

Example

Markup before plugin:

<div class="flyout">
    <input class="flyout__trigger" />
    <div class="flyout__live-region" aria-live="off">
        <div class="flyout__overlay">
            <!-- flyout content -->
        </div>
    </div>
</div>

Execute plugin:

$('.flyout').hoverFlyout();

Markup after plugin:

<div class="flyout" id="inputflyout-0">
    <input aria-controls="inputflyout-0-overlay" aria-expanded="false" />
    <div class="flyout__live-region" aria-live="off">
        <div class="flyout__overlay" id="inputflyout-0-overlay">
            <!-- flyout content -->
        </div>
    </div>
</div>

'Hover' event on button will now toggle aria-expanded state of button. CSS can use this state to hide/show overlay. For example:

.flyout__overlay {
    display: none;
    position: absolute;
    z-index: 1;
}
.flyout__trigger[aria-expanded=true] ~ .flyout__live-region > .flyout__overlay {
    display: block;
}

Params

  • options.overlaySelector - selector for overlay element (default: '.flyout__overlay')
  • options.triggerSelector - selector for trigger element (default: '.flyout__trigger')
  • options.expandedClass - if present, uses this class instead of aria-expanded (default: null)

Events

  • flyoutExpand - the flyout has expanded
  • flyoutCollapse - the flyout has collapsed

Development

Useful NPM task runners:

  • npm start for local browser-sync development.
  • npm test runs tests & generates reports (see reports section below)
  • npm run tdd test driven development: watches code and re-tests after any change
  • npm run build cleans, lints, tests and minifies

Execute npm run to view all available CLI scripts.

Reports

Each test run will generate the following reports:

  • /test_reports/coverage contains Istanbul code coverage report
  • /test_reports/html contains HTML test report
  • /test_reports/junit contains JUnit test report

CI Build

https://travis-ci.org/makeup-jquery/jquery-hover-flyout

Code Coverage

https://coveralls.io/github/makeup-jquery/jquery-hover-flyout?branch=master

You can’t perform that action at this time.