Coder Social home page Coder Social logo

tristen / hoverintent Goto Github PK

View Code? Open in Web Editor NEW
329.0 9.0 54.0 148 KB

:mouse: Fire mouse events when a user intends it

Home Page: https://tristen.ca/hoverintent/

License: MIT License

CSS 24.79% JavaScript 36.95% HTML 38.25%
hoverintent mouse javascript ui

hoverintent's People

Contributors

bronzehedwick avatar darkspotinthecorner avatar dependabot[bot] avatar hollymphillips avatar lichunqiang avatar parshap avatar skeggse avatar solant avatar timoxley avatar tristen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hoverintent's Issues

Is it possible to include an unminified browser-ready version to the dist folder?

Howdy,

Sometimes we might want to include an unminified browser-ready version of the script. Is it possible to include one example of it to the dist folder?

The index.js at the root folder uses modules which is then compiled to browser-ready and made available as dist/hoverintent.min.js, it would be nice to have a browser-ready version, without minification, at dist/hoverintent.js.

Thanks

Docs fix

$('.element').hoverintent(function() {
// Handler in
}, function() {
// Handler out
});

Edit hoverintent -> hoverIntent

document.querySelectorAll doesn't seem to work

I have this code

var _hoverTriggers = document.querySelectorAll('.JS-navigator__trigger--hover');

hoverintent(_hoverTriggers,
    function() {
        console.log('in');
    }, function() {
        console.log('out');
    }
);

And I am receiving this error:

Uncaught TypeError: e.addEventListener is not a function

The most common use for this plugin is triggering mega menus on navigation items. It doesn't make sense not supporting query selector all in this context.

Focus handler

Hi,
I don't believe the dropdown would be triggered when using keyboards for accessibility, correct? That would focus on something more like focus instead of hover; looking at the current codebase that doesn't appear to be pluggable; I believe I might be able to bundle ontop of some internal functions to call those methods, but wanted to hear your thoughts. Thanks!

Clicking and clicking-and-holding should be interpreted as no intention to hover

Hello,

When a user clicks or clicks-and-holds on a hoverintent element, that should be interpreted as no intention to hover. In the vernacular of your [fantastic] library, the interval should be reset upon any type of clicking.

I would argue that any type of clicking signifies that the user does not intend to hover. Do you agree?

The problem I'm encountering is that, on an element where click is trapped, sometimes an overlay I created appears when it shouldn't. What's happening is that the user is clicking on the element (or clicking-and-holding) after a hover is initiated but before the interval has elapsed (and the "in" function is called).

how to remove/disable

cool utility, but there doesn't appear to be any way to remove or disable it after you've attached it to an element :(

I created a vue version

Hi, feel free to close/remove this ticket, but was unsure of how else to get in touch. I modified your script a tiny bit (Updated it to modern export default syntax) and wrapped it up in a vue directive to allow vue users to use this package. You can find it here: https://github.com/hybridwebdev/hover-intent-vue just wanted to say thank you, and allow users the ability to find my package. I'd be all for a link to the repo in your readme if that's something you wanna do.

Misleading description

I'm greatly insulted with the fact that "It has no dependencies" statement is actually a lie. Please, remove it from the description.
screenshot_20180323_135929

Ability to reset state

I'm currently working on a project where because of an animated event the onOut callback doesn't get called. This is problematic because the following onOver event never registers. It would be nice to be able to reset the state to the "out" state.

Not sure how this would best be implemented, maybe something like

var hover = hoverintent(/* etc... */);
// ...
hover.resetState();

Add cjs support

Please provide 'require()' support for cjs. Personally I don't have a need for any other modules, but it would probably help others to just add umd support.

I can create a pull request if you respond to this. Otherwise I'll just publish a fork to npm.

Not working properly or at all with iframe element

I only added properly in the title as it is working in some cases in Chrome (depends which edge your cursor crossing and also from interval option - higher interval works worse)

Best to reproduce that in Firefox where it is not working at all.

Iframe has to be without a borders.

Main cause is in mousemove event, as it is not triggered when moving cursor above iframe content. It can be triggered when iframe has a border but I think it is because it belongs to actual document and not to the iframe document.

Here is jsfiddle with issue reproduced https://jsfiddle.net/zejrqg73/1/.

I have tried to use StackBlitz but it has a problem with Firefox.

I do have a fix proposition so I will put PR shortly.

Accessibility: close/cancel when escape is pressed

If anyone has figured out a way to make this work, that would be awesome. For accessibility reasons, you should be able to hit the escape key in order to hide the bit that is being revealed on hover. I have yet to figure out an elegant way to do this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.