diff options
author | Annabel Dunstone <annabel.dunstone@gmail.com> | 2016-05-25 19:42:43 +0300 |
---|---|---|
committer | Annabel Dunstone <annabel.dunstone@gmail.com> | 2016-05-26 01:14:28 +0300 |
commit | 79f890ca8549132699bc8169eff73b5c7ff25699 (patch) | |
tree | 162202ec14a130ec7a93e73cc406608cb4bc11d0 /app/assets/javascripts/layout_nav.js.coffee | |
parent | 1965ec6324d7a67aec485b98030794657624d3ec (diff) |
Add fade out to sub nav
Diffstat (limited to 'app/assets/javascripts/layout_nav.js.coffee')
-rw-r--r-- | app/assets/javascripts/layout_nav.js.coffee | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/assets/javascripts/layout_nav.js.coffee b/app/assets/javascripts/layout_nav.js.coffee index 43dc941a82f..3c39ec32f26 100644 --- a/app/assets/javascripts/layout_nav.js.coffee +++ b/app/assets/javascripts/layout_nav.js.coffee @@ -1,13 +1,13 @@ class @LayoutNav $ -> $('.fade-left').addClass('end-scroll') - $('#scrolling-tabs').on 'scroll', -> + $('.scrolling-tabs').scroll (event) -> + el = $(event.target) currentPosition = $(this).scrollLeft() - $('.fade-left').toggleClass('end-scroll', currentPosition is 0) - mobileScreenWidth = 480 controlBtnWidth = $('.controls').width() maxPosition = $(this)[0].scrollWidth - $(this).parent().width() maxPosition += controlBtnWidth if $('.nav-control').length and $(window).width() > mobileScreenWidth - $('.fade-right').toggleClass('end-scroll', currentPosition is maxPosition) + el.find('.fade-left').toggleClass('end-scroll', currentPosition is 0) + el.find('.fade-right').toggleClass('end-scroll', currentPosition is maxPosition) |