通过 JavaScript 进行 Web 浏览器缩放和优雅降级
我正在开发一个网络项目,该项目具有客户强制要求的一些辅助功能,包括“字体大小更改器”,以允许为视障用户增加字体大小。
尽管我认为使用浏览器中的内置缩放功能可以获得更好的体验,但客户坚持认为他们的用户不会知道使用这些内置功能,因此我们必须提供一个文本大小更改小部件。
如果可能的话,我想做的是让这些页面元素调用浏览器自己的缩放功能(例如,Firefox 中的 Ctrl + +)。如果浏览器不支持这种缩放方法,那么我可能会转而使用 css 来增加字体大小。
我怎样才能最好地实现这种功能?有可能吗?有什么我忽略的解决方案吗?
I'm working on a web project that has some accessibility features mandated by the client, including a "font size changer" to allow the font size to be increased for visually impaired users.
Despite my arguments that a better experience will be had by using the built-in zoom features in the browser, the client has insisted that their users will not know to use these built-in features, so we must provide a text size changing widget.
What I'd like to do, if possible, is cause these page elements to invoke the browser's own zoom functionality (Ctrl + + in firefox, for example). If the browser doesn't support this method of zooming, then I might fall back to increasing the font size with css.
How can I best implement this kind of feature? Is it even possible? Is there some solution that I've overlooked?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,没有办法使用浏览器的内置功能。不过,可以使用 CSS3 或 javascript 来完成。如需 CSS3 示例,请查看此处: http://www.css3.com/css-zoom/
There is no way as far as I know to use the browser's built in function. However it can be done with CSS3 or javascript. for a CSS3 example look here: http://www.css3.com/css-zoom/