Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-06-13 17:58:09 +0300
committerPhil Hughes <me@iamphill.com>2016-06-13 17:58:09 +0300
commit29130f37ad15bf5aa4ac2cf62d0ea8249218dcd6 (patch)
treeed1d02403dbbc00b2b6489d463ea725bad2462ac /app/assets/javascripts
parent5e955d2cba4b3f0508874ef49fa549a638d4944c (diff)
Hides the fade right unless required
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/layout_nav.js.coffee44
1 files changed, 30 insertions, 14 deletions
diff --git a/app/assets/javascripts/layout_nav.js.coffee b/app/assets/javascripts/layout_nav.js.coffee
index 6adac6dac97..f02292dd4f3 100644
--- a/app/assets/javascripts/layout_nav.js.coffee
+++ b/app/assets/javascripts/layout_nav.js.coffee
@@ -1,14 +1,30 @@
-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)
+hideEndFade = ($scrollingTabs) ->
+ $scrollingTabs.each ->
+ $this = $(@)
+
+ $this
+ .find('.fade-right')
+ .toggleClass('end-scroll', $this.width() is $this.prop('scrollWidth'))
+
+$ ->
+ $('.fade-left').addClass('end-scroll')
+
+ hideEndFade($('.scrolling-tabs'))
+
+ $(window)
+ .off 'resize.nav'
+ .on 'resize.nav', ->
+ hideEndFade($('.scrolling-tabs'))
+
+ $('.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()) - 1
+ # maxPosition += controlBtnWidth if size isnt 'xs' and $('.nav-control').length
+ console.log maxPosition, currentPosition
+
+ $el.find('.fade-left').toggleClass('end-scroll', currentPosition is 0)
+ $el.find('.fade-right').toggleClass('end-scroll', currentPosition is maxPosition)