Sha256: 6ccee8ad455f30acc5870fd0c6a339ad0a88a85ecfe85a2c5df0aad1b71c7c37

Contents?: true

Size: 497 Bytes

Versions: 1

Compression:

Stored size: 497 Bytes

Contents

class TentStatus.Views.ExpandingTextArea extends Backbone.View
  initialize: ->
    @$el.on 'keyup', @adjustSize

    @initialHeight = @$el.height()

  adjustSize: (shouldExecute = false) =>
    @_padding ||= (parseInt(@$el.css 'padding-top') || 0) + (parseInt(@$el.css 'padding-bottom') || 0)
    scrollY = window.scrollY
    scrollX = window.scrollX
    @$el.height(0)
    @$el.css('height', "#{ Math.max(@el.scrollHeight - @_padding, @initialHeight) }px")
    window.scrollTo scrollX, scrollY

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tent-status-0.0.1 assets/javascripts/views/expanding_textarea.js.coffee