以编程方式阻止 Firefox 自动调整图像大小
默认情况下,在 Firefox 中,每次打开图像时,它都会重新调整大小以适合浏览器窗口,现在,如果您查看大量图像,则每次加载图像时都必须单击图像才能查看完整尺寸,这可能会变得很烦人。
有一种方法可以在 about:config 中关闭它,但这对于更广泛的公众来说不是一个解决方案。
有没有办法通过某些 JavaScript 函数、CSS 或其他方法来关闭它?
By default in Firefox every time you open an image it will re-size to fit within the browser window, now if you view a lot of images this can become annoying having to click on the image every time it loads to see it full size.
There is a way to switch off that in about:config, but this is not a solution for a broader public.
Is there a way to switch that off by some JavaScript function, or CSS, or something else?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您想在浏览器中关闭自动调整图像大小,则可以
about:config
browser.enable_automatic_image_resizing
false
如果您希望访问者能够使用它,我可以重复 Jeremy Sydik 在设计可访问的网站中所写的内容,
在这种情况下,您确实不应该决定您的用户是否需要 Firefox 的自动调整大小功能。 您始终可以选择为访问者提供更好的用户体验的解决方案。 例如,您可以安装 Lightbox 变体 Daniel A. White已经提到了。
还有great_llama的解决方案来打开a中的图像HTML 页面。
If you would like to switch off auto-resizing images in your browser, then you can
about:config
browser.enable_automatic_image_resizing
false
If you want it for your visitors, I just can repeat what Jeremy Sydik writes in Design Accessible Web Sites,
And in this case, you really shouldn't decide whether your users want Firefox's auto-resizing feature or not. You can always choose a solution that gives better user experience to your visitors. For instance, you may install a Lightbox variant as Daniel A. White already mentioned.
There is also great_llama's solution to open images inside a HTML page.
指向使用具有适当源的 IMG 标记的动态页面,而不是指向原始图像。 使用查询字符串或类似的东西将图像名称传递到页面。
Point to a dynamic page that uses an IMG tag with the appropriate source, rather than pointing to the raw image. Use the querystring or something similar to pass the image name to the page.
我认为无论如何都无法改变这种行为,至少使用 javascript 或 css 是这样。
为什么不使用 jQuery Lightbox?
http://leandrovieira.com/projects/jquery/lightbox/
I dont think there is anyway to change that behavior, at least using javascript or css.
Why not use a jQuery Lightbox?
http://leandrovieira.com/projects/jquery/lightbox/
虽然我没有尝试过,但我不明白为什么如果你将它包装在 html 中而不直接链接到图像,它会自动调整大小。
如果这是一个选项,只需将其包装在 html 中:
Though I have not tried it, I don't see why it would autosize if you wrapped it in html and not link directly to the image.
if that is an option, just wrap it in html:
如果您是图像的所有者,请将图像嵌入 HTML 文档中。 仅当您直接在浏览器中打开图像时,Firefox 才会调整图像大小。
如果您从 Firefox 用户的角度来看,我认为:config 是禁用此功能的适当位置。
If you are the owner of the image, embed the image in an HTML document. Firefox resizes an image only if you open it directly in the browser.
If you are talking from a Firefox user's point of view, I think about:config is the appropriate place to disable this functionality.