我设置了几个不同尺寸的textarea:
<textarea class="markItUp" rows="5" cols="80" name="upstring">
Run Code Online (Sandbox Code Playgroud)
要么
<textarea class="markItUp" rows="100" cols="80" name="upstring">
Run Code Online (Sandbox Code Playgroud)
但是在应用了markitup之后,它们总是被调整为18行.为什么?
我用firebug检查了行并且它没有变化(仍然是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]
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2155 次 |
| 最近记录: |