gpt4 book ai didi

javascript - jQuery Tooltipster 应该在悬停时显示一个隐藏的 DIV

转载 作者:太空宇宙 更新时间:2023-11-04 13:41:13 24 4
gpt4 key购买 nike

我的代码是

<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.0.min.js"></script>
<script type="text/javascript" src="../../_js/jquery.tooltipster.min.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(document).ready(function () {
$('#HHH').tooltipster({
content: $('#BTE' )
})
})
</script>

我的 div 是 <div id="BTE">ABCDEFG</div><div id="HHH"></DIV>

我最初想隐藏我的“BTE”,当鼠标悬停在“hhh”周围时,“bte”应该出现。我想知道如何实现这一目标?我试过display:none但它不起作用。

最佳答案

如果你不想使用任何插件,试试这样,

// Initially hide the tooltip <div>
$("#HHH").hide();

// On mouse-over add some CSS and show the tooltip <div>
$("#BTE").mousemove(function (e) {
$("#HHH").css("top", e.pageY);
$("#HHH").css("margin-left", e.pageX);
$("#HHH").show();
});

// On mouse-out hide the tooltip <div> again
$("#BTE").mouseout(function () {
$("#HHH").hide();
});

Demo

关于javascript - jQuery Tooltipster 应该在悬停时显示一个隐藏的 DIV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22706161/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com