Adaptive FitText:有更好的方法吗?

发布于 2024-12-20 19:19:25 字数 293 浏览 1 评论 0原文

我有一段代码可以使 FitText.js 适应自定义媒体查询。我希望它对于每个预定义的媒体查询都有不同的值。

该代码可以工作,但到目前为止它很丑陋并且不是最佳的。

http://jsfiddle.net/rKFYs/9/

我尝试过重新编码,但我的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.

http://jsfiddle.net/rKFYs/9/

I've tried recoding it but my js skills are not that good.

JS Gurus, please help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

惜醉颜 2024-12-27 19:19:25

我不久前写了一个 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.

水波映月 2024-12-27 19:19:25

实际上,我最终编写了自己的插件,名为 AdaptiveText.js 看看!

I actually ended up writing my own plugin called AdaptiveText.js check it out!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文