summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/layout_nav.js.coffee
blob: 6adac6dac97ba1fa386d7005d79749617f1805cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class @LayoutNav
  $ ->
    $('.fade-left').addClass('end-scroll')
    $('.scrolling-tabs').on 'scroll', (event) ->
      $this = $(this)
      $el = $(event.target)
      currentPosition = $this.scrollLeft()
      size = bp.getBreakpointSize()
      controlBtnWidth = $('.controls').width()
      maxPosition = $this.get(0).scrollWidth - $this.parent().width()
      maxPosition += controlBtnWidth if size isnt 'xs' and $('.nav-control').length

      $el.find('.fade-left').toggleClass('end-scroll', currentPosition is 0)
      $el.find('.fade-right').toggleClass('end-scroll', currentPosition is maxPosition)