diff options
author | Clement Ho <ClemMakesApps@gmail.com> | 2017-08-31 15:35:22 -0500 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2017-08-31 15:35:22 -0500 |
commit | 7f055ea273a5955e8a7596074a4d9214ea45be86 (patch) | |
tree | f6c6324a3524856a25d65bd4038c747ece0bea54 | |
parent | b4a82829f811f407e2108a54767102c7f25b3eea (diff) | |
download | gitlab-ce-7f055ea273a5955e8a7596074a4d9214ea45be86.tar.gz |
Add mouseleave debounce
-rw-r--r-- | app/assets/javascripts/feature_highlight/feature_highlight.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/assets/javascripts/feature_highlight/feature_highlight.js b/app/assets/javascripts/feature_highlight/feature_highlight.js index 02d3e216510..f5e38fc8879 100644 --- a/app/assets/javascripts/feature_highlight/feature_highlight.js +++ b/app/assets/javascripts/feature_highlight/feature_highlight.js @@ -1,4 +1,5 @@ import Cookies from 'js-cookie'; +import _ from 'underscore'; import { getCookieName, getSelector, @@ -13,6 +14,7 @@ export const setupFeatureHighlightPopover = (id) => { const $parent = $selector.parent(); const $popoverContent = $parent.siblings('.feature-highlight-popover-content'); const hideOnScroll = hidePopover.bind($selector); + const debouncedMouseleave = _.debounce(mouseleave, 300); $selector // Setup popover @@ -28,7 +30,7 @@ export const setupFeatureHighlightPopover = (id) => { `, }) .on('mouseenter', mouseenter) - .on('mouseleave', mouseleave) + .on('mouseleave', debouncedMouseleave) .on('inserted.bs.popover', setupDismissButton) .on('show.bs.popover', () => { window.addEventListener('scroll', hideOnScroll); |