Javascript JS Can';t将图像置于光标后面的中心
我希望图像以光标为中心 有人能帮忙吗 非常感谢,Lorenzo。请尝试遵循css代码Javascript JS Can';t将图像置于光标后面的中心,javascript,debugging,Javascript,Debugging,我希望图像以光标为中心 有人能帮忙吗 非常感谢,Lorenzo。请尝试遵循css代码 img#image { position: absolute; display: none; z-index: 99; max-width: 50vw; transform: translate(-50%, -50%); } span:hover img#image { display: block; pointer-events: none; }
img#image {
position: absolute;
display: none;
z-index: 99;
max-width: 50vw;
transform: translate(-50%, -50%);
}
span:hover img#image {
display: block;
pointer-events: none;
}
谢谢你的信息!这样可以改进解决方案,但并不总是将图像置于中心。例如,当您向上或向下滚动图像时,图像的位置会很差。你知道为什么吗?你需要考虑SCROLLTOP和SLROWLY父滚动元素感谢帮助。在我的网站上,h3包含在一系列
DIV
中。所以这把小提琴实际上更准确<代码>https://jsfiddle.net/Mengolor/2wzv6tr1/1/ 在这种情况下是否可以将图像居中?
img#image {
position: absolute;
display: none;
z-index: 99;
max-width: 50vw;
transform: translate(-50%, -50%);
}
span:hover img#image {
display: block;
pointer-events: none;
}