Sha256: 847bdf16d6fe2272c3b79816d1c384dfac223b3c73b2fe64d377f60900bd0028

Contents?: true

Size: 930 Bytes

Versions: 1

Compression:

Stored size: 930 Bytes

Contents

scrollToComponentSection = ($component, duration = 0) ->
  sectionOffset = $component.closest('.component-section-item').offset().top + $('.page-sidebar').scrollTop()
  headerHeight = $('.page-sidebar .brand-logo').outerHeight()
  $('.page-sidebar').scrollTo(sectionOffset - headerHeight, duration: duration)

responsive_sidebar_navigation = ->
  # Scroll to active element's section on page change
  if ($activeItem = $('.component-item.active')).length
    scrollToComponentSection($activeItem)

  $('.component-item').on 'click', 'a', (e) ->
    console.log 'scroll to ', $(e.currentTarget).closest('.component-item')
    scrollToComponentSection($(e.currentTarget), 150)

$(document).on 'page:change', ->
  responsive_sidebar_navigation()

  $(".selectize-tags").selectize
    delimiter: ","
    persist: false
    create: (input) ->
      value: input
      text: input

$(window).resize ->
  responsive_sidebar_navigation()

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
para-0.4.0 app/assets/javascripts/para/admin/theme_actions.coffee