10 examples of 'onhover' in JavaScript

Every line of 'onhover' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
19function hover(e) {
20 const object = self.objects[self.meshes.indexOf(e.mesh)];
21 object.onOver({ action: e.action, object });
22}
42callHoverCallback() {
43 if (typeof this.Canvas.options.onHover === 'function' && this.lastData !== this.currentData) {
44 this.lastData = this.currentData;
45 this.Canvas.options.onHover({
46 value: this.currentData,
47 x: this.x,
48 y: this.y,
49 });
50 }
51}
249export function hover($el: ElementView, options: HoverEventOptions) {
250 let timeout = 0;
251 let active = false;
252 let wasTriggeredByMouse = false;
253
254 $el.on('mouseover', () => {
255 if (options.preventMouseover && options.preventMouseover()) return;
256 clearTimeout(timeout);
257 timeout = delay(() => {
258 if (active) return;
259 if (options.enter) options.enter();
260 wasTriggeredByMouse = true;
261 active = true;
262 }, options.delay);
263 });
264
265 $el.on('mouseout', () => {
266 if (!wasTriggeredByMouse) return;
267 clearTimeout(timeout);
268 timeout = delay(() => {
269 if (!active) return;
270 if (options.exit) options.exit();
271 active = false;
272 }, options.exitDelay || options.delay);
273 });
274
275 const $clickTarget = options.$clickTarget || $el;
276 $clickTarget.on('click', () => {
277 if (active && (!wasTriggeredByMouse)) {
278 if (options.exit) options.exit();
279 active = false;
280 } else if (!active) {
281 if (options.enter) options.enter();
282 wasTriggeredByMouse = false;
283 active = true;
284 }
285 });
286
287 $el.on('clickOutside', () => {
288 if (!active) return;
289 if (options.exit) options.exit();
290 active = false;
291 });
292}
651_hoverChanged() {
652 if (!this._ignoreHover) {
653 // Skip if dock is not in autohide mode for instance because it is shown
654 // by intellihide.
655 if (this._autohideIsEnabled) {
656 if (this._box.hover)
657 this._show();
658 else
659 this._hide();
660 }
661 }
662}
239function hover(hover) {
240 labelMaterial.opacity = hover ? 1.0 : 0.5;
241 markAsChanged();
242}
12handleHover(isHover, event) {
13 if ((this.props.isTouchDevice && event === 'touch') ||
14 (!this.props.isTouchDevice && event === 'mouse')) {
15 if (`/${this.props.path}` !== this.props.item.path) {
16 $(this.refs.container).velocity('stop');
17 $(this.refs.container).velocity({opacity: isHover ? 1 : 0.8}, {duration: 200});
18 }
19 }
20}
104onHover (hovered, e) {
105 return this.props.dispatch(state => ({
106 ...state,
107 hovered
108 }))
109}
122onHover(fn) {
123 return this._attachListener('hover', this.el, this.el, fn);
124}
132async hover() {
133 await this._scrollIntoViewIfNeeded();
134 const {x, y} = await this._clickablePoint();
135 await this._page.mouse.move(x, y);
136}
397function hover(type, item)
398{
399 const id = getID(item);
400 if (!id)
401 return;
402 const hovered = $(".hover", this);
403 if (hovered)
404 hovered.classList.remove("hover");
405 const option = $(`#${id}`, this);
406 option.classList.add("hover");
407 this.label.setAttribute("aria-activedescendant", id);
408 const popup = this.popup;
409 // if it's the mouse moving, don't auto scroll (annoying)
410 if (type !== "mouse" && popup.scrollHeight > popup.clientHeight)
411 {
412 const scrollBottom = popup.clientHeight + popup.scrollTop;
413 const elementBottom = option.offsetTop + option.offsetHeight;
414 if (elementBottom > scrollBottom)
415 {
416 popup.scrollTop = elementBottom - popup.clientHeight;
417 }
418 else if (option.offsetTop < popup.scrollTop)
419 {
420 popup.scrollTop = option.offsetTop;
421 }
422 }
423}

Related snippets