我有一个像div一样的气泡,当div悬停在上面时就会出现。在气泡div中,有一个文本框。
如何使您可以将鼠标悬停在div上,气泡将会出现,然后您可以将鼠标悬停在气泡上,在文本框内进行编辑,当光标既未触及气泡也未触及文本框时,气泡将消失?
另外,我不想要它,这样你就可以在气泡上悬停,让它出现,只能先悬停在div上,然后再悬停在气泡上。
谢谢!
发布于 2014-01-10 23:53:03
这太简单了
泡泡你的泡泡吧!id是div id的父对象
我们开始吧
$('#parent').hover(function(){
$('#bubble').fadeIn();
});
$('#bubble').click(function(){
$(this).fadeOut();
});还有一件事,如果你的页面中有很多气泡,你可以这样做吗?当它悬停时,你的气泡代码可以放在你想要的任何div中,这个气泡显示并更改你的代码到有气泡的代码div下,有'tooltip‘类,有气泡类
$('.tooltip').hover(function(){
if($('.bubble',this).hasClass('active')) return false ; // if this bubble is show , do nothing
$('.bubble.active').fadeOut();// hide any other bubble that is show
$('.bubble',this).fadeIn().addClass('active'); // show this bubble
});
$('.bubble').click(function(){
$(this).fadeOut().removeClass('active');
});发布于 2014-01-10 23:57:26
由于问题是关于javascript而不是jQuery:
document.getElementById('mydiv').addEventListener('mouseover', function(
document.getElementById('mybubble').style.visibility='visible';
));
document.getElementById('mybubble').addEventListener('click', function(
document.getElementById('mybubble').style.visibility='hidden';
));
document.getElementById('mydiv').addEventListener('click', function(
document.getElementById('mybubble').style.visibility='hidden';
));https://stackoverflow.com/questions/21048447
复制相似问题