I wrote a very simple hint script with a preliminary delay on display.
but i have some problems with my code
I don’t want to show the tooltip too much with a hang time of less than 500 ms, but I have a blink effect due to the fadeTo () animation effect
this means that when I am on .imgSpan and then quickly turn off the mouse in less than 500 ms, the .img tag will be displayed after 500 ms and will quickly hide
here is my code
$(document).ready(function () { $('.img').css('display','none'); }); $('.imgSpan').hover( function(){ $(".imgSpan:hover .img").delay(500).fadeTo(500, 1); }, function(){ $(".img").css("display", "none"); $(".img").fadeTo(0, 0); } );
HTML code:
<span class='imgSpan'> <a> <img src='/images/image.png' class='middle' /> </a> <img class='img' src='image_path' alt='image' />
notes:
source share