是否可以访问和控制浏览器的页面调整大小功能?
由于视力问题,一些网络用户可能需要比正常字体更大的字体,虽然传统上设计人员可能已经实现了通过单击按钮来调整文本大小的脚本,但浏览器现在具有非常方便的缩放功能,可以更好地放大文本整个页面,并且不会给开发人员带来布局问题。
并非所有网络用户都知道浏览器中的这些功能或如何访问它们,因此我想知道是否可以在网站上添加一个缩放按钮来控制浏览器的缩放功能,从而简化用户体验。
那么,有可能吗?这是个好主意吗?
Some web users may require larger fonts than the norm due to issues with their eyesight, and whilst traditionally designers may have implemented script that would resize text at the click of a button, browsers now have very handy zoom functions that work much more nicely to magnify an entire page and don't tend to create layout issues for developers.
Not all web users may be aware of these functions in their browsers or how to access them, so I was wondering if it's possible to add a zoom button to a website which controls the browser's zoom functionality, simplifying the user experience.
So, is it possible? Is it even a good idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过 body 标记上的 CSS 来实现:
一些简单的 javascript 来增加/减少缩放级别,并且您基本上复制了浏览器的“更大/更小”按钮。
You can do it via CSS on the body tag:
Some simple javascript to increase/decrease the zoom level, and you've basically replicated the browser's "bigger/smaller" buttons.
试试这个
jsfiddle.net
Try this
jsfiddle.net