mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-25 04:26:08 +10:00
Hides the fade right unless required
This commit is contained in:
@@ -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
|
||||
hideEndFade = ($scrollingTabs) ->
|
||||
$scrollingTabs.each ->
|
||||
$this = $(@)
|
||||
|
||||
$el.find('.fade-left').toggleClass('end-scroll', currentPosition is 0)
|
||||
$el.find('.fade-right').toggleClass('end-scroll', currentPosition is maxPosition)
|
||||
$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)
|
||||
|
||||
@@ -283,6 +283,7 @@
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
right: 15px;
|
||||
z-index: 2;
|
||||
|
||||
li.active {
|
||||
font-weight: bold;
|
||||
|
||||
Reference in New Issue
Block a user