tristen / hoverintent Goto Github PK
View Code? Open in Web Editor NEW:mouse: Fire mouse events when a user intends it
Home Page: https://tristen.ca/hoverintent/
License: MIT License
:mouse: Fire mouse events when a user intends it
Home Page: https://tristen.ca/hoverintent/
License: MIT License
After upgrading to 1.0.0
, the timeout
option is no longer respected.
Implement event delegation.
Option 1
hoverintent(ele [, selector ], handlerIn, handlerOut);
Option 2
hoverintent(ele, handlerIn, handlerOut).options({
on: 'selector'
});
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
$('.element').hoverintent(function() {
// Handler in
}, function() {
// Handler out
});
Edit hoverintent -> hoverIntent
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.
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!
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).
cool utility, but there doesn't appear to be any way to remove or disable it after you've attached it to an element :(
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.
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();
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.
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.