10 examples of 'addeventlistener hover' in JavaScript

Every line of 'addeventlistener hover' 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
this disclaimer
239function hover(hover) {
240 labelMaterial.opacity = hover ? 1.0 : 0.5;
241 markAsChanged();
242}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

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}
122onHover(fn) {
123 return this._attachListener('hover', this.el, this.el, fn);
124}
177itemEl.addEventListener('mouseover', function itemHover (e) {
178 if (!galleryItem.preloadState) {
179 galleryItem.preloadState = 1
180 preloadImage(
181 src,
182 img => {
183 galleryItem.preloadState = 2
184 galleryItem.w = img.width
185 galleryItem.h = img.height
186 itemEl.removeEventListener('mouseover', itemHover)
187 },
188 () => {
189 /** Reset the preload state in case of error and remove the listener */
190 galleryItem.preloadState = 0
191 itemEl.removeEventListener('mouseover', itemHover)
192 }
193 )
194 }
195})
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}
20function trigger_hover(this_) {
21 reinit_buttons();
22 // actions on focus into the button
23 if ($(this_).hasClass(selected_chosen)) {
24 $(this_).addClass(selected_preselected);
25 } else {
26 $(this_).addClass(selected);
27 }
28 return false
29}
19function hover(e) {
20 const object = self.objects[self.meshes.indexOf(e.mesh)];
21 object.onOver({ action: e.action, object });
22}
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}
445public handleImgHover(): void {
446 const oListItem = this.oListItem;
447
448 for (const key in oListItem) {
449 if (oListItem.hasOwnProperty(key)) {
450
451 const element = oListItem[key];
452
453 element.addEventListener('mouseenter', () => {
454 clearInterval(this.timer);
455
456 this.aidedHandleArrowVisible(Scroll.defaultConfig.showArrows);
457 }, false);
458
459 element.addEventListener('mouseleave', () => {
460 this.handleAutoScroll();
461
462 this.aidedHandleArrowVisible(false);
463 }, false);
464 }
465 }
466}
12function sfHover() {
13var ULs = document.getElementsByTagName("UL");
14var len = ULs.length;
15 for(var i=0;i<len;i++) {
16 if(ULs[i].className.indexOf("cssmenu_horiz") != -1)
17 sfHoverEvents(ULs[i].getElementsByTagName("LI"));
18 if(ULs[i].className.indexOf("cssmenu") != -1)
19 sfHoverEvents(ULs[i].getElementsByTagName("LI"));
20 if(ULs[i].className.indexOf("cssmenu_vert") != -1)
21 sfHoverEvents(ULs[i].getElementsByTagName("LI"));
22 }
23}

Related snippets