-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add delay in tooltip #61
Conversation
9474c8a
to
53be0cd
Compare
|
||
tooltipPromise = window.setTimeout(function() { | ||
init(event, item, options); | ||
tooltipActive = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why isn't this line a part of init?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn’t put tooltipActive
in init()
or clear()
because it’s only referenced by onmouseover
, onmousemove
, and onmouseout
listeners, so putting it closer to the event listeners might be easier to read?
@@ -2,7 +2,7 @@ | |||
|
|||
(function() { | |||
// by default, delay showing tooltip for 100 ms | |||
const DELAY = 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you shouldn't use const in ES5.
f0194a6
to
b42d1ab
Compare
visibility:hidden
instead ofdisplay:none
because we need to know the rendered tooltip height and width to place it in the right positionclear()
onAppear
,onDisappear
,onMove
callbacks in examples to make sure that these callbacks are executed in the right moments given time delay. For example,onAppear
callback should be called when tooltip actually becomes visible.