Sha256: fda80c6ccfdeb6d871b089a6b6ccc30087d6f5a7b26d90f232c551297a8e89c1

Contents?: true

Size: 854 Bytes

Versions: 6

Compression:

Stored size: 854 Bytes

Contents

class CirrusKit
  constructor: ->
    @container = $('.cirruskit')
    @nav_panel = @container.find '.nav-panel'
    @content_panel = @container.find '.content-panel'
    @setup_events()

  setup_events: =>
    @nav_panel.hover @nav_panel_hover, @nav_panel_stop_hover

    @content_panel.scroll (e) =>
      @update_top_fixed(e)

  nav_panel_hover: =>
    @nav_panel.addClass 'hover'

  nav_panel_stop_hover: =>
    @nav_panel.removeClass 'hover'

  update_top_fixed: (e) =>
    # Let .cirruskit-top-fixed stick to top on scroll
    $fixed = @container.find('.cirruskit-top-fixed')
    if @content_panel.scrollTop() > $fixed.offset().top
      $fixed.addClass 'fixed'
      @content_panel.css 'padding-top', $fixed.height()
    else
      $fixed.removeClass 'fixed'
      @content_panel.css 'padding-top', 0

(exports ? this).cirruskit = new CirrusKit()

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
CirrusKit-0.0.7 js/cirruskit/cirruskit.coffee
CirrusKit-0.0.6 js/cirruskit/cirruskit.coffee
CirrusKit-0.0.5 js/cirruskit/cirruskit.coffee
CirrusKit-0.0.4 js/cirruskit/cirruskit.coffee
CirrusKit-0.0.2 js/cirruskit/cirruskit.coffee
CirrusKit-0.0.1 js/cirruskit/cirruskit.coffee