markitup changes the explicitly set size of textarea?
I set up several textarea's with diffrent sizes as:
<textarea class="markItUp" rows="5" cols="80" name="upstring">
or
<textarea class="markItUp" rows="100" cols="80" name="upstring">
But after the markitup has been applied they are always resized to 18 rows. Why?
I have checked rows with firebug and its unchanged (still 5 or 100) so changing that wont help.
Since I have lots of texts I want 开发者_运维技巧to do small edits to I do not what to have a to small or to big area to start with since I already know the appropriate size.
Pleas help
After some playing around to understand things I produced the following code to solve my problem:
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 rules generally override the rows and cols attributes, so rather than rely on those, try sizing your textareas with css 'height' and 'width.'
精彩评论