是否可以在页面中同时使用按键和鼠标滚轮来禁用缩放?
我想在所有浏览器中禁用缩放,无论是 Ctrl + -/+ 或 Ctrl + 滚轮。我尝试使用链接中给出的代码。我还尝试使用以下代码禁用 Ctrl 键:
$(document).keydown(function(e){
if(e.keyCode == 17)
return false;
});
但它不起作用。我实际上不想提醒用户缩放已禁用,因此我无法在上面的代码中使用 alert()
。
有什么建议吗?
I want to disable zoom, be it Ctrl + -/+ or Ctrl + Scroll Wheel in all browsers. I tried using the code given in link. I also tried to disable the Ctrl key by using the following code:
$(document).keydown(function(e){
if(e.keyCode == 17)
return false;
});
But it doesn't work. I actually don't want to alert the user that zoom is disabled, so I can't use the alert()
inside the above code.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
变焦的存在是有原因的。理解它,围绕它构建,但不要试图禁用它。最后,这是一个不受你控制的鲍瑟功能。您可以破解和削减,但我怀疑您是否会为您所要求的问题找到完美甚至稳定的解决方案。
Zoom is there for a reason. Understand it, build around it, but don't try to disable it. In the end, it's a bowser feature that is out of your hands. You can hack and slash but I doubt you'll ever find a perfect or even stable solution for what you are asking.