2016-06-16 23:09:34 +05:30
|
|
|
hideEndFade = ($scrollingTabs) ->
|
|
|
|
$scrollingTabs.each ->
|
|
|
|
$this = $(@)
|
|
|
|
|
|
|
|
$this
|
2016-08-24 12:49:21 +05:30
|
|
|
.siblings('.fade-right')
|
|
|
|
.toggleClass('scrolling', $this.width() < $this.prop('scrollWidth'))
|
2016-06-16 23:09:34 +05:30
|
|
|
|
|
|
|
$ ->
|
|
|
|
|
|
|
|
hideEndFade($('.scrolling-tabs'))
|
|
|
|
|
|
|
|
$(window)
|
|
|
|
.off 'resize.nav'
|
|
|
|
.on 'resize.nav', ->
|
|
|
|
hideEndFade($('.scrolling-tabs'))
|
|
|
|
|
|
|
|
$('.scrolling-tabs').on 'scroll', (event) ->
|
|
|
|
$this = $(this)
|
|
|
|
currentPosition = $this.scrollLeft()
|
|
|
|
maxPosition = $this.prop('scrollWidth') - $this.outerWidth()
|
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
$this.siblings('.fade-left').toggleClass('scrolling', currentPosition > 0)
|
|
|
|
$this.siblings('.fade-right').toggleClass('scrolling', currentPosition < maxPosition - 1)
|