[英]onmouseover show/ hide div and can select the text of div
I want to Show and hide one tooltip on hover of an anchor. 我想显示和隐藏锚点悬停时的一个工具提示。 but tooltip should be there till my cursor on it.
但是工具提示应该一直存在,直到我的光标停留在上面。
$('#showReasonTip').mouseover(function(){
$(this).parent().find('#reasonTip').slideDown()}).mouseout(function(){
$(this).parent().find('#reasonTip').slideUp()
}
)
thanks in advance. 提前致谢。
Try 尝试
jQuery(function ($) {
$('#showReasonTip').hover(function () {
var $target = $('#reasonTip');
clearTimeout($target.data('hoverTimer'));
$target.stop(true, true).slideDown();
}, function () {
var $target = $('#reasonTip');
var timer = setTimeout(function () {
$target.stop(true, true).slideUp();
}, 200);
$target.data('hoverTimer', timer);
});
$($('#reasonTip')).hover(function () {
clearTimeout($(this).data('hoverTimer'));
}, function () {
$(this).stop(true, true).slideUp();
});
});
You should try using mouseleave
instead of mouseout
and that too on #reasonTip
and not on #showReasonTip
. 您应该尝试在
#reasonTip
而不是#showReasonTip
上使用mouseleave
而不是mouseout
。
$('#showReasonTip').mouseover(function(){
$(this).parent().find('#reasonTip').slideDown()
});
$('#reasonTip').mouseleave(function(){
$(this).parent().find('#reasonTip').slideUp()
});
Here's the modified fiddle with a small change in your code. 这是经过修改的小提琴 ,只对您的代码进行了少量更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.