Sha256: f704ba3093d93fd8b7b4ae5caa8fc02bbc75ce5fc504732125119e1332d24325

Contents?: true

Size: 700 Bytes

Versions: 2

Compression:

Stored size: 700 Bytes

Contents

angular.module('TextArea', [])
  .directive 'textarea', ($timeout) ->
    restrict: 'E'
    link: (scope, element, attributes) ->
      scope.initialHeight = scope.initialHeight || element[0].style.height
      element.css('resize','none').css('overflow','hidden').css('border','0px')
      initial = element.parent().css('height')
      resize = ->
        element.parent().css('height',element.parent()[0].offsetHeight)
        element[0].style.height = scope.initialHeight
        element[0].style.height = "" + Math.max(20,element[0].scrollHeight) + "px"
        $timeout ->
          element.parent().css('height',initial)
      element.on("blur keyup change", resize)
      $timeout(resize, 0)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
material_raingular-0.0.2.7 lib/assets/javascripts/directives/textarea.coffee
material_raingular-0.0.2.6.7 lib/assets/javascripts/directives/textarea.coffee