【发布时间】:2016-05-16 05:45:04
【问题描述】:
我正在开发一个项目,我正在使用 Reveal JS 以幻灯片的形式向用户展示数据。
有时我发现文本溢出视口。
由于此图像中显示的文本不可见
我尝试根据屏幕高度动态减小文本大小,如下所示:
var $present_section = $('section.present');
var section_bottom = $present_section.offset().top + $present_section.height();
var allowed_height = $(document).height() - $present_section.offset().top;
if (section_bottom > allowed_height) {
var cur_font_size = parseInt($present_section.css('font-size'));
$present_section.css('font-size', cur_font_size - 1);
}
在递归循环中运行此代码将调整<section> 的字体大小以适应文档高度。
有没有更好的方法或插件来处理这个问题而不减少幻灯片中的字符数?
【问题讨论】:
标签: javascript html css reveal.js