我正在嘗試創建一個彈出框,當您將滑鼠懸停在文本上時會彈出該框。當您將滑鼠懸停在文本上時,文本會消失,但不會重新出現。可以對下面的代碼進行任何改進嗎?
$(document).ready(function(){
$("clo-t").hide();
$("clo").hover(function(){
$("clo-t").show();,
$("clo-t").hide();
});
})
uj5u.com熱心網友回復:
你應該使用mouseoutandmouseover代替
$(document).ready(function() {
$(".clo").mouseover(() => {
$(".clo-t").show();
}).mouseout(t => {
if (!$(t.target).hasClass("clo-t"))
$(".clo-t").hide();
})
})
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/375417.html
標籤:javascript 查询
上一篇:如何為每個td獲取不同的名稱?
