我正在尝试使一些文本作为元素的属性在光标悬停时向上切换。目前,我看到这段代码发生了奇怪的事情,但感觉我已经非常接近了......有什么想法吗?
$(".hoverDes").mousemove(function(){
$(".hoverDes").toggle(function(e){
var hoverIt = $(this).attr("hoverDesDiv");
$("#hoverDiv").text(hoverIt).show();
$("#hoverDiv").css("top", e.clientY-30).css("left", e.clientX-50);
}).mouseout(function(){
$("#hoverDiv").hide();
})
});
最佳答案
你的问题对我来说不够清楚,但从你上面的代码我猜你需要这个
$(".hoverDes").hover(function(e){
var hoverIt = $(this).attr("hoverDesDiv");
$("#hoverDiv").text(hoverIt).show('slow');
},
function(e){
$("#hoverDiv").hide('slow');
});
关于javascript - 使用 jQuery 将鼠标悬停在文本上进行切换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9351909/