zoukankan      html  css  js  c++  java
  • textarea高度随内容撑高

    (function($){
          $.fn.autoTextarea = function(options) {
                var defaults={
                  maxHeight:null,
                  minHeight:$(this).height()
                };
                var opts = $.extend({},defaults,options);
                return $(this).each(function() {
                  $(this).height($(this)[0].scrollHeight);
                  $(this).bind("paste cut keydown keyup focus blur",function(){
                    var height,style=this.style;
                    this.style.height = opts.minHeight + 'px';
                    if (this.scrollHeight > opts.minHeight) {
                      if (opts.maxHeight && this.scrollHeight > opts.maxHeight) {
                        height = opts.maxHeight;
                      } else {
                        height = this.scrollHeight;
                      }
                      style.height = height + 'px';
                    }
                  });
                });
              };
            })(jQuery);
        $("#textarea").autoTextarea();

  • 相关阅读:
    浅谈display:flex
    MVVM
    HDFS 伪分布式集群搭建
    HDFS入门
    Hadoop-HDFS
    Hadoop介绍
    大数据-高并发Nginx
    大数据-高并发LVS3Keepalived
    大数据-高并发LVS2实验
    大数据-高并发LVS1
  • 原文地址:https://www.cnblogs.com/hlyin/p/9541806.html
Copyright © 2011-2022 走看看