K
K
kevus2018-06-10 18:52:21
JavaScript
kevus, 2018-06-10 18:52:21

How to make a function execute when hovering over an object?

Hello. There is such code
https://jsfiddle.net/25q0ex97/3/ .
(works only in new versions of Chrome)

It should fire on hover

document.getElementById('page').onmouseover = function(){
document.getElementById('paste').click();
};


The code works fine when loading the local version.
But when loading "from outside" (apparently because of the work of the iframe), for the code to work, it is required to "touch" the window - just by clicking.

That is, the usual hovering over the iframe itself does not activate the code.

But at the same time, here is an example https://jsfiddle.net/richardcwc/qdjkreo5/ where the code fires in an iframe, directly as an alert.

I read it behind a promise, maybe this is the case, but I didn’t find anything with my database :(

Tell me :(
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kevus, 2018-06-10
@kevus

Console throws Uncaught (in promise) undefined - Promise.then (async) - paste.onclick - document.getElementById.onmouseover.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question