diff options
author | Phil Hughes <me@iamphill.com> | 2017-05-11 13:37:40 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-05-11 13:37:40 +0300 |
commit | 5d74fc8a5496423b31eb4dc0daf02b39d0fb51de (patch) | |
tree | e906674140b89962a5adf3896c5bde84bffbe33d /app/assets/javascripts/merge_request_tabs.js | |
parent | 4067dd4f84681dd109fb8e1957b6327b4db20193 (diff) |
Use position sticky on merge request tabs
Removes the need for Bootstraps affix on browser that support sticky positions. On these browsers, there should be a slight performance improvement as there will be no scrolling events, it will all be handled by the browser
Diffstat (limited to 'app/assets/javascripts/merge_request_tabs.js')
-rw-r--r-- | app/assets/javascripts/merge_request_tabs.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js b/app/assets/javascripts/merge_request_tabs.js index 93c30c54a8e..a3dff25c93b 100644 --- a/app/assets/javascripts/merge_request_tabs.js +++ b/app/assets/javascripts/merge_request_tabs.js @@ -358,6 +358,13 @@ import BlobForkSuggestion from './blob/blob_fork_suggestion'; // So we dont affix the tabs on these if (Breakpoints.get().getBreakpointSize() === 'xs' || !$tabs.length) return; + /** + If the browser does not support position sticky, it returns the position as static. + If the browser does support sticky, then we allow the browser to handle it, if not + then we default back to Bootstraps affix + **/ + if ($tabs.css('position') !== 'static') return; + const $diffTabs = $('#diff-notes-app'); $tabs.off('affix.bs.affix affix-top.bs.affix') |