Sha256: 13880fc97b38bac87aefbb69d6b85ddfd3996b2f81045dc597e9234388903fd4

Contents?: true

Size: 880 Bytes

Versions: 7

Compression:

Stored size: 880 Bytes

Contents

###
 * Requires jquery.responsiveText.js
###
$ ->
  # responsive text
  $('.responsive').not('table').each (index, object) ->
    $this = $ this
    
    compression = 10
    min = 10
    max = 200
    scrollTime = 650
    scrollReset = 200

    compression = parseFloat $this.attr('data-compression') || compression
    min = parseFloat $this.attr('data-min') || min
    max = parseFloat $this.attr('data-max') || max

    $(object).responsiveText
      compressor: compression
      minSize: min
      maxSize: max

    $this.hover (->
      difference = $this.get(0).scrollWidth - $this.width()
      scrollTime = difference if difference > scrollTime
      if difference > 0
        $this.stop().animate
          "text-indent": -difference
        , scrollTime
    ), ->
      $this.stop().animate
        "text-indent": 0
      , scrollReset
      
    return
    
  return

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
groundworkcss-0.4.1 app/assets/javascripts/groundworkcss/components/responsiveText.coffee
groundworkcss-0.4.0 app/assets/javascripts/groundworkcss/components/responsiveText.coffee
groundworkcss-0.3.2 app/assets/javascripts/groundworkcss/components/responsiveText.coffee
groundworkcss-0.3.0 vendor/assets/javascripts/groundworkcss/components/responsiveText.coffee
groundworkcss-0.2.4 vendor/assets/javascripts/groundworkcss/components/responsiveText.coffee
groundworkcss-0.2.3 vendor/assets/javascripts/groundworkcss/components/responsiveText.coffee
groundworkcss-0.2.2 vendor/assets/javascripts/groundworkcss/components/responsiveText.coffee