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();

  • 相关阅读:
    FILE
    基础知识const/typedef/函数指针/回调函数
    strchr
    ftell
    rewind
    fread
    poj 2309BST解题报告
    hdoj 4004The Frog's Games解题报告
    哈理工oj 1353LCM与数对解题报告
    poj 2453An Easy Problem解题报告
  • 原文地址:https://www.cnblogs.com/hlyin/p/9541806.html
Copyright © 2011-2022 走看看