E
E
Eugene2015-11-13 05:42:28
JavaScript
Eugene, 2015-11-13 05:42:28

How to set hover effect when hovering over image with timeout?

Hello,

You need to set the Hover effect, which will not work immediately when hovering over the picture, but only if the mouse cursor lingers on the picture for 1 second. If the cursor only "touched" the image, then nothing is done. How can this be implemented?

Tried:

setTimeout(function() {
  ...
}, 500)

but, it only delays the start of the effect.

<div class="thumb">
  <a href="#">
    <img src="preview-1.jpg"/>
  </a>
</div>
<div class="thumb">
  <a href="#">
    <img src="preview-2.jpg"/>
  </a>
</div>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey delphinpro, 2015-11-13
@Scumtron

You started right, but didn't finish a bit :)
jsfiddle.net/DelphinPRO/b1ybz2jn

E
Evgeny Petrov, 2015-11-13
@EvgenZZ

div .thumb {
transition: 0s background-color;
}
div .thumb:hover{
background-color:red;
transition-delay:1s;
}

R
Rafael™, 2015-11-13
@maxminimus

What if I don't have a mouse or cursor on my iPad?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question