Adaptive FitText:有更好的方法吗?
我有一段代码可以使 FitText.js 适应自定义媒体查询。我希望它对于每个预定义的媒体查询都有不同的值。
该代码可以工作,但到目前为止它很丑陋并且不是最佳的。
我尝试过重新编码,但我的js技能没那么好。
JS高手们,请帮忙!
I have a piece of code that adapts FitText.js to custom media queries. I wanted it to have different values for each predefined media query.
The code works, but it is by far ugly and by far not optimal.
I've tried recoding it but my js skills are not that good.
JS Gurus, please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不久前写了一个 FitText 的混音版本,它会尽力缩放文本以适合其容器元素(请参阅 http://blog.rjzaworski.com/2011/11/fit-text-to-element-inflatetext-js/)。
使用 FitText 概念的这种变体,您只需调整媒体查询中容器 div 的大小,并让插件缩放文本以适应。
I wrote a remix of FitText a little while back that will do its best to scale your text to fit its container element (see http://blog.rjzaworski.com/2011/11/fit-text-to-element-inflatetext-js/).
Using this variation on the FitText concept, you would simply need to adjust the size of the container div in your media queries and let the plugin scale your text to fit.
实际上,我最终编写了自己的插件,名为 AdaptiveText.js 看看!
I actually ended up writing my own plugin called AdaptiveText.js check it out!