Sha256: 4055ac217e1cc396f616e56ed736e04344cae376a2d6c6f808977364ae4df712

Contents?: true

Size: 404 Bytes

Versions: 1

Compression:

Stored size: 404 Bytes

Contents

class iconly.Scroller
  constructor: (options = {}) ->
    @_topSpacing = options.topSpacing
    @_root       = $('html body')
    that         = this
    $('[data-scroll-to]').on 'click', (e) -> that._onScroll(e, this)

  _onScroll: (e, link) ->
    el = $(link.hash)

    return unless el.length
    e.preventDefault()

    @_root.animate({
      scrollTop: el.offset().top - @_topSpacing
    }, 200)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iconly-1.0.0 app/assets/javascripts/iconly/scroller.coffee