题
我设置几个文本区域与不同势大小为:
<textarea class="markItUp" rows="5" cols="80" name="upstring">
或
<textarea class="markItUp" rows="100" cols="80" name="upstring">
该markitup已经施加但是经过它们总是大小调整为18点的行。为什么呢?
我已经检查行与萤火虫和其不变(仍然5或100),以便改变这不会帮助。
由于我有很多文本我想要做小编辑我没有什么有一个小或大面积开始以来,我已经知道了适当的大小。
普莱斯帮助
解决方案
在一些玩弄明白的事情,我产生了以下代码来解决我的问题:
jQuery(".markItUp").markItUp(mySettings).css('height', function() {
/* Since line-height is set in the markItUp-css, fetch that value and
split it into value and unit. */
var h = jQuery(this).css('line-height').match(/(\d+)(.*)/)
/* Multiply line-height-value with nr-of-rows and add the unit. */
return (h[1]*jQuery(this).attr('rows'))+h[2]
});
其他提示
CSS规则通常会覆盖的行和cols属性,所以,而不是依赖于这些,尝试用CSS“高度”和调整您的文字区域“的宽度。”
不隶属于 StackOverflow