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-09-16 16:32:43 +0300
committerPhil Hughes <me@iamphill.com>2016-10-06 12:17:34 +0300
commit97dc95b18e5a5c29daab84e0d65522b3d3158dc1 (patch)
tree7520b6a7dc674e8fdcce8e6f032874f4f2b20552 /app/assets/javascripts/merge_request_tabs.js
parent8962a3359c4282c755fff0fa08deeb64d74543a0 (diff)
Fixed tests
Diffstat (limited to 'app/assets/javascripts/merge_request_tabs.js')
-rw-r--r--app/assets/javascripts/merge_request_tabs.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js b/app/assets/javascripts/merge_request_tabs.js
index f685af7d97e..1a214cdd00e 100644
--- a/app/assets/javascripts/merge_request_tabs.js
+++ b/app/assets/javascripts/merge_request_tabs.js
@@ -369,18 +369,21 @@
};
MergeRequestTabs.prototype.initAffix = function () {
+ var $tabs = $('.js-tabs-affix');
+
// Screen space on small screens is usually very sparse
// So we dont affix the tabs on these
- if (Breakpoints.get().getBreakpointSize() === 'xs') return;
+ if (Breakpoints.get().getBreakpointSize() === 'xs' || !$tabs.length) return;
- var $tabs = $('.js-tabs-affix'),
- tabsWidth = $tabs.outerWidth(),
- $diffTabs = $('#diff-notes-app'),
- offsetTop = $tabs.offset().top - ($('.navbar-fixed-top').height() + $('.layout-nav').height());
+ var tabsWidth = $tabs.outerWidth(),
+ $diffTabs = $('#diff-notes-app'),
+ offsetTop = $tabs.offset().top - ($('.navbar-fixed-top').height() + $('.layout-nav').height());
$tabs.off('affix.bs.affix affix-top.bs.affix')
.affix({
- offset: offsetTop
+ offset: {
+ top: offsetTop
+ }
}).on('affix.bs.affix', function () {
$tabs.css({
left: $tabs.offset().left,