Sha256: ab69d03bd3554f4eb4c0a25c6aaf0af89c4203921610dd022c9e9dc2f08d8aff

Contents?: true

Size: 571 Bytes

Versions: 11

Compression:

Stored size: 571 Bytes

Contents

class Apiv1.IndexController extends Ember.ObjectController
  queryParams: ['anchor']
  anchor: null

  +observer anchor
  scroll2Anchor: ->
    return @smoothScrollTo 0 unless _.contains ["about", "products", "contacts"], @anchor
    Ember.run.schedule 'afterRender', @, =>
      el$ = $('#' + @anchor)
      @smoothScrollTo @topOffset el$ if el$.length > 0
  
  smoothScrollTo: (y) ->
    $("#page-wrapper").animate scrollTop: y if y?

  topOffset: (el$) ->
    p1 = $(".site-content").position()
    p2 = el$.position()
    return unless p1? and p2?
    p2.top - p1.top

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
cloudrider-0.3.0 generica/app/assets/javascripts/controllers/index_controller.js.em
cloudrider-0.2.18 generica/app/assets/javascripts/controllers/index_controller.js.em
cloudrider-0.2.15 generica/app/assets/javascripts/controllers/index_controller.js.em
cloudrider-0.2.14 generica/app/assets/javascripts/controllers/index_controller.js.em
cloudrider-0.2.12 generica/app/assets/javascripts/controllers/index_controller.js.em
cloudrider-0.2.11 generica/app/assets/javascripts/controllers/index_controller.js.em
cloudrider-0.2.10 generica/app/assets/javascripts/controllers/index_controller.js.em
cloudrider-0.2.9 generica/app/assets/javascripts/controllers/index_controller.js.em
cloudrider-0.2.8 generica/app/assets/javascripts/controllers/index_controller.js.em
cloudrider-0.2.7 generica/app/assets/javascripts/controllers/index_controller.js.em
cloudrider-0.2.6 generica/app/assets/javascripts/controllers/index_controller.js.em